/**
 * Employee Management System - Custom Styles
 * /assets/css/style.css
 */

/* ========================================
   Base Styles
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Toast Notifications
   ======================================== */

#toast-container {
    max-width: 400px;
}

.toast {
    min-width: 320px;
    max-width: 400px;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease-out forwards;
    opacity: 0;
    transform: translateX(100%);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.hiding {
    animation: slideOut 0.3s ease-in forwards;
}

.toast-success {
    background-color: #10B981;
    color: white;
}

.toast-error {
    background-color: #EF4444;
    color: white;
}

.toast-warning {
    background-color: #F59E0B;
    color: white;
}

.toast-info {
    background-color: #3B82F6;
    color: white;
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ========================================
   Modal Styles
   ======================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.modal-overlay.active {
    opacity: 1;
}

.modal-content {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 2rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.2s ease-in-out;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* ========================================
   Form Styles
   ======================================== */

input:focus,
select:focus,
textarea:focus {
    outline: none;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* ========================================
   Table Styles
   ======================================== */

table {
    border-collapse: collapse;
}

tbody tr {
    transition: background-color 0.15s ease-in-out;
}

tbody tr:hover {
    background-color: #F9FAFB;
}

/* ========================================
   Button Styles
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    border: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #4F46E5;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #4338CA;
    transform: scale(1.02);
}

.btn-success {
    background-color: #10B981;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
}

.btn-danger {
    background-color: #EF4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #DC2626;
}

.btn-secondary {
    background-color: #6B7280;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #4B5563;
}

/* ========================================
   Badge Styles
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

.badge-active {
    background-color: #D1FAE5;
    color: #065F46;
}

.badge-inactive {
    background-color: #F3F4F6;
    color: #374151;
}

/* ========================================
   Card Styles
   ======================================== */

.card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #E5E7EB;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #E5E7EB;
    background-color: #F9FAFB;
}

/* ========================================
   Loading Spinner
   ======================================== */

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #E5E7EB;
    border-top-color: #4F46E5;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   Avatar Styles
   ======================================== */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    text-transform: uppercase;
}

.avatar-sm {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
}

.avatar-md {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.875rem;
}

.avatar-lg {
    width: 3rem;
    height: 3rem;
    font-size: 1rem;
}

.avatar-xl {
    width: 4rem;
    height: 4rem;
    font-size: 1.25rem;
}

/* ========================================
   Utility Classes
   ======================================== */

.text-gradient {
    background: linear-gradient(to right, #4F46E5, #7C3AED);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-glow {
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.3);
}

/* ========================================
   Responsive Utilities
   ======================================== */

@media (max-width: 640px) {
    .toast {
        min-width: auto;
        max-width: calc(100vw - 2rem);
    }
    
    #toast-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    #toast-container,
    nav,
    footer,
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #E5E7EB;
    }
}

/* ========================================
   Accessibility
   ======================================== */

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid #4F46E5;
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #4F46E5;
    color: white;
    padding: 8px;
    z-index: 100;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
