/* Additional Animations */
@keyframes slideDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
        height: 0;
        padding: 0;
        margin: 0;
        border: none;
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Form Validation States */
.semester-group.valid,
.course-group.valid {
    border-color: var(--success-color) !important;
    background: rgba(16, 185, 129, 0.05) !important;
    transition: all 0.3s ease;
}

.semester-group.error,
.course-group.error {
    border-color: var(--error-color) !important;
    background: rgba(239, 68, 68, 0.05) !important;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Enhanced Form Layout */
.input-row {
    display: flex;
    gap: 15px;
    margin-top: 8px;
}

@media (max-width: 768px) {
    .input-row {
        flex-direction: column;
        gap: 10px;
    }
}

.input-col {
    flex: 1;
    position: relative;
}

.input-label {
    font-size: 0.75rem;
    color: var(--gray-color);
    margin-top: 4px;
    text-align: center;
}

/* Remove Buttons */
.btn-remove {
    position: absolute;
    right: 0;
    top: 0;
    background: var(--error-color);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    z-index: 10;
}

.btn-remove:hover {
    transform: scale(1.1);
    background: #dc2626;
}

/* Toast Notifications */
.error-toast,
.notification-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
    max-width: 400px;
}

.error-toast {
    background: var(--error-color);
    color: white;
}

.notification-toast {
    background: var(--info-color);
    color: white;
}

.notification-toast.success {
    background: var(--success-color);
}

.notification-toast.warning {
    background: var(--warning-color);
}

.error-toast button,
.notification-toast button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.error-toast button:hover,
.notification-toast button:hover {
    opacity: 1;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-light);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Print Optimizations */
@media print {
    .no-print {
        display: none !important;
    }
    
    .calculator-container {
        break-inside: avoid;
    }
    
    .result-value {
        color: #000 !important;
        font-size: 24pt !important;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Styles */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Loading States */
.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: var(--dark-color);
    color: var(--light-color);
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.875rem;
    line-height: 1.4;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--dark-color) transparent transparent transparent;
}