/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

/* --- General Body & Typography --- */
body {
    font-family: 'Tajawal', sans-serif;
    background-color: #f8fafc; /* slate-50 */
    color: #334155; /* slate-700 */
    min-height: 100vh; /* Ensure body takes full viewport height */
    overflow-y: auto; /* Allow vertical scrolling if content overflows */
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 700;
    text-align: center;
    transition: all 0.2s ease-in-out;
    border: 1px solid transparent;
    cursor: pointer;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #2563eb; /* blue-600 (AA contrast with white) */
    color: white;
}
.btn-primary:hover {
    background-color: #1d4ed8; /* blue-700 */
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.39);
}

.btn-secondary {
    background-color: #047857; /* emerald-700 (AA contrast with white) */
    color: white;
}
.btn-secondary:hover {
    background-color: #065f46; /* emerald-800 */
}

.btn-neutral {
    background-color: white;
    color: #475569; /* slate-600 */
    border-color: #e2e8f0; /* slate-200 */
}
.btn-neutral:hover {
    background-color: #f8fafc; /* slate-50 */
    border-color: #cbd5e1; /* slate-300 */
}

.btn-danger {
    background-color: #dc2626; /* red-600 (AA contrast with white) */
    color: white;
}
.btn-danger:hover {
    background-color: #b91c1c; /* red-700 */
}

/* --- Forms & Inputs --- */
.form-card {
    background-color: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.form-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e293b; /* slate-800 */
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: #475569; /* slate-600 */
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e1; /* slate-300 */
    border-radius: 0.5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus {
    outline: none;
    border-color: #3b82f6; /* blue-500 */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.form-input:disabled, .form-input[readonly] {
    background-color: #f1f5f9; /* slate-100 */
    cursor: not-allowed;
}

/* Ensure submit buttons within forms get primary button styles */
form button[type="submit"] {
    @apply bg-blue-500 text-white font-bold py-2 px-4 rounded-lg hover:bg-blue-600 transition duration-200;
}

/* Explicitly ensure visibility for links in auth pages footer */
p[data-translate-key="already_have_account"],
p[data-translate-key="no_account_yet"],
p[data-translate-key="go_back_to_login"] { /* Added 'go_back_to_login' here */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important; /* Ensure it's part of the normal flow */
    height: auto !important; /* Allow height to be determined by content */
    margin-top: 1.5rem !important; /* Add some margin to separate from the form card */
    z-index: 10; /* Ensure it's above other elements if any overlap */
}

p[data-translate-key="already_have_account"] a,
p[data-translate-key="no_account_yet"] a,
p[data-translate-key="go_back_to_login"] a { /* Added 'go_back_to_login' here */
    visibility: visible !important;
    display: inline !important;
    opacity: 1 !important;
}


/* --- Tables --- */
.table-container {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    text-align: right;
    font-size: 0.875rem;
}

.data-table thead th {
    background-color: #f1f5f9; /* slate-100 */
    color: #475569; /* slate-600 */
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tbody tr {
    border-bottom: 1px solid #e2e8f0; /* slate-200 */
}

.data-table tbody tr:last-of-type {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background-color: #f8fafc; /* slate-50 */
}

.data-table tbody td {
    padding: 1rem 1.5rem;
    color: #334155; /* slate-700 */
}

/* --- Date Tag Styles --- */
.date-tag {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px; /* pill shape */
    font-weight: 500;
    font-size: 0.75rem;
    display: inline-block;
}
.date-tag.expired {
    background-color: #fee2e2; /* red-100 */
    color: #b91c1c; /* red-700 */
}
.date-tag.expiring-soon {
    background-color: #fef3c7; /* yellow-100 */
    color: #b45309; /* yellow-700 */
}
.date-tag.valid {
    color: #64748b; /* slate-500 */
}


/* --- Stat Cards (Dashboard) --- */
.stat-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.stat-card .icon-container {
    width: 50px;
    height: 50px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-card .icon-container i {
    color: white;
    font-size: 1.25rem;
}
.stat-title {
    color: #64748b; /* slate-500 */
    font-weight: 700;
}
.stat-value {
    font-size: 1.875rem;
    font-weight: 800;
    margin-top: 0.25rem;
}

/* --- Message Containers --- */
.message-container {
    margin-top: 1rem;
    text-align: center;
    font-weight: 500;
    min-height: 1.5rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

/* --- NEW: Data Management Page Specific Styles (Moved from HTML) --- */
/* General Card Styling */
.card {
    background-color: white;
    padding: 1.5rem; /* Adjusted padding for better fit */
    border-radius: 0.75rem; /* Slightly less rounded for consistency */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* Stronger shadow */
    border: 1px solid #e2e8f0; /* slate-200 */
}
.card-header {
    font-size: 1.5rem; /* Adjusted font size */
    font-weight: 800;
    color: #1e293b; /* slate-800 */
    margin-bottom: 1rem; /* Adjusted margin */
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Gap between icon and text */
}
.card p {
    color: #475569; /* slate-600 */
    margin-bottom: 1.5rem; /* Adjusted margin */
    font-size: 0.95rem; /* Slightly smaller text */
}

/* Button Styling - Refined for Data Management */
.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem; /* Increased gap for icons */
    padding: 0.75rem 1.5rem; /* Larger padding */
    border-radius: 0.75rem; /* More rounded buttons */
    font-weight: 600; /* Slightly less bold */
    text-align: center;
    color: white;
    transition: all 0.3s ease-in-out;
    transform: translateY(0); /* Reset transform */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* Add shadow */
}
.btn-action:hover {
    transform: translateY(-2px); /* Subtle lift effect */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* Enhanced shadow on hover */
}

.btn-export-primary {
    background-color: #3b82f6; /* blue-500 */
}
.btn-export-primary:hover {
    background-color: #2563eb; /* blue-600 */
}
.btn-backup-special {
    background-color: #8b5cf6; /* violet-500 */
}
.btn-backup-special:hover {
    background-color: #7c3aed; /* violet-600 */
}
.btn-import-secondary {
    background-color: #10b981; /* emerald-500 */
    color: white; /* Ensure text is white */
}
.btn-import-secondary:hover {
    background-color: #059669; /* emerald-600 */
}
.btn-restore-danger {
    background-color: #ef4444; /* red-500 */
}
.btn-restore-danger:hover {
    background-color: #dc2626; /* red-600 */
}

/* File Input Wrapper Styling - Make it look like a button */
.file-input-wrapper {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    color: #475569; /* slate-600 */
    background-color: #e2e8f0; /* slate-200 */
    transition: all 0.3s ease-in-out;
    transform: translateY(0);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
}
.file-input-wrapper:hover {
    background-color: #cbd5e1; /* slate-300 */
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.file-input-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Message Containers Styling */
.message-container {
    margin-top: 1.5rem; /* Increased margin */
    padding: 1rem; /* Increased padding */
    border-radius: 0.75rem; /* More rounded corners */
    font-weight: 600; /* Slightly bolder text */
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08); /* Subtle shadow */
}
.message-info {
    background-color: #e0f2fe; /* light blue */
    color: #0c4a6e; /* dark blue */
}
.message-success {
    background-color: #dcfce7; /* light green */
    color: #166534; /* dark green */
}
.message-error {
    background-color: #fee2e2; /* light red */
    color: #991b1b; /* dark red */
}
.message-warning {
    background-color: #fffbeb; /* light yellow */
    border-left: 4px solid #f59e0b; /* orange border */
    color: #b45309; /* dark orange */
}

/* --- Empty message containers should not render blank boxes --- */
.message-container:empty {
    display: none;
}

/* --- Mobile navigation (off-canvas sidebar) --- */
#mobile-menu-btn {
    display: none;
}

#mobile-nav-overlay {
    display: none;
}

.sidebar-close-btn {
    display: none;
}

@media (max-width: 767px) {
    #mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }

    #app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        right: 0;
        z-index: 60;
        width: 16rem;
        max-width: 85vw;
        display: flex !important;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.25s ease-in-out;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    }

    html[dir="ltr"] #app-sidebar {
        right: auto;
        left: 0;
        transform: translateX(-100%);
    }

    #app-sidebar.sidebar-open {
        transform: translateX(0);
    }

    .sidebar-close-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        position: absolute;
        top: 0.5rem;
        left: 0.5rem;
        color: #475569;
        background: transparent;
        border: 0;
        cursor: pointer;
    }

    #mobile-nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 50;
        background-color: rgba(15, 23, 42, 0.55);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    }

    body.nav-open #mobile-nav-overlay {
        opacity: 1;
        visibility: visible;
    }

    body.nav-open {
        overflow: hidden;
    }
}

@media (prefers-reduced-motion: reduce) {
    #app-sidebar,
    #mobile-nav-overlay {
        transition: none;
    }
}
