/* ============================================================= */
/*  styles.css – FINAL CONSOLIDATED & OPTIMIZED (v3)            */
/*  Upgraded with CSS variables, responsive improvements,       */
/*  hover/focus effects, accessibility, and modern styling      */
/* ============================================================= */

/* ==================== GLOBAL / BASE ==================== */

/* --- Added CSS Variables for consistency & maintainability --- */
:root {
    --primary: #007aff;
    --primary-dark: #0056b3;
    --success: #28a745;
    --danger: #dc3545;
    --text-dark: #333;
    --bg-light: #f3f4f6;
    --radius: 10px;
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
    --transition: 0.25s ease;
    --sidebar-width: 200px;
    --container-padding: 24px;
    --form-padding: 32px;
    --h1-font: 32px;
    --h2-font: 24px;
    --status-active-bg: #d1fae5;
    --status-active-text: #065f46;
    --status-inactive-bg: #fee2e2;
    --status-inactive-text: #b91c1c;
}

/* Base resets */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    min-height: 100vh;
}

/* --- Global link styles --- */
a { color: var(--primary); text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.8; }

/* --- Global button transitions --- */
button {
    transition: background 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}
button:hover { transform: translateY(-1px); }
button:focus { outline: none; box-shadow: 0 0 0 3px rgba(0,122,255,0.4); }
button:disabled { background: #cbd5e0; cursor: not-allowed; opacity: 0.7; }


/* ==================== LAYOUT ==================== */

/* --- Simplified wrapper: use only .dashboard-layout --- */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    gap: 0;
}

/* Sidebar width now uses variable */
.main-content { 
    flex: 1;
    margin-left: var(--sidebar-width); /* Modified */
    padding-bottom: 60px;
    padding: 2px var(--container-padding); /* Modified */
    transition: margin-left 0.3s ease;
}

.main-content h1, .main-content h2, .main-content .add-package-button { padding-left: 10px; }

/* Smooth interior spacing */
.main-content > *:not(:last-child) { margin-bottom: 20px; } /* Added */


/* ==================== SIDEBAR ==================== */
.sidebar {
    background: #1a202c;
    color: white;
    width: var(--sidebar-width); /* Modified */
    position: fixed;
    top: 0; left: 0; bottom: 0;
    padding: var(--container-padding);
    z-index: 1000;
    transition: transform 0.3s ease, opacity 0.3s ease; /* Modified */
    overflow-y: auto;
    box-shadow: var(--shadow); /* Modified */
}

/* Sidebar header */
.sidebar-header h2 {
    font-size: 22px; font-weight: 700; margin: 0 0 8px;
    border-bottom: 1px solid #4a5568; padding-bottom: 12px;
}
.sidebar-header p { margin: 8px 0 24px; font-size: 14px; opacity: 0.9; }

/* Sidebar links */
.sidebar a, .nav-link {
    display: block;
    padding: 12px 16px; /* Modified for clickable area */
    color: #cbd5e0;
    text-decoration: none;
    border-radius: var(--radius);
    margin: 6px 0;
    font-size: 14.5px;
    transition: all 0.25s ease;
}
.sidebar a i { margin-right: 10px; font-size: 16px; } /* Added for icons */

/* Hover & active states */
.sidebar a:hover, .nav-link:hover { 
    background: #4a5568;
    color: white;
    transform: translateX(6px);
}
.sidebar a.active, .nav-link.active { 
    background: var(--primary); 
    font-weight: 600;
}

/* Mobile sidebar collapsed state */
.sidebar.collapsed { transform: translateX(-100%); } /* Added */


/* ==================== CONTAINER ==================== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    background: white;
    padding: 0px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}


/* ==================== FORMS ==================== */
.form-container {
    background: white;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: var(--form-padding); /* Modified */
    margin-bottom: 32px;
    transition: all 0.3s ease;
}
.form-container:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(0,0,0,0.18); } /* Added */

.form-group { margin-bottom: 18px; text-align: left; }
.form-group label {
    display: block;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 7px;
    font-size: 14px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius);
    font-size: 15px;
    transition: all 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0,122,255,0.15);
    outline: none;
}
/* Textarea support */
.form-group textarea { resize: vertical; } /* Added */

/* Invalid input states */
input.error, select.error, textarea.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px rgba(229,62,62,0.15);
}


/* ==================== BUTTONS ==================== */
button, .add-button, .edit-button, .toggle-status-button, .delete-button {
    padding: 8px 16px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    display: inline-block;
    white-space: nowrap;
}
.edit-button          { background: var(--primary); color: white; }
.toggle-status-button { background: var(--success); color: white; }
.toggle-status-button.deactivate { background: var(--danger); }
.delete-button        { background: var(--danger); color: white; }

.edit-button:hover    { background: var(--primary-dark); }
.toggle-status-button:hover,
.delete-button:hover  { opacity: 0.92; }

/* Add & Logout buttons */
.add-button {
    background: var(--success); /* Modified */
    color: white;
    padding: 12px 20px;
    text-align: center;
    font-weight: 600;
    margin-left: 10px;
    border-radius: var(--radius);
}
.logout-button {
    width: 100%;
    padding: 14px;
    background: var(--danger); /* Modified */
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
}
.logout-button:hover { background: #c53030; }

.form-container button[type="submit"], .submit {
    display: block;
    margin: auto;
    padding: 12px;
    background: var(--primary);
    color: white;
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    border-radius: var(--radius);
}
.form-container button[type="submit"]:hover, .submit:hover {
    background: var(--primary-dark);
}


/* ==================== TABLES ==================== */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin: 28px 0;
}
table { width: 100%; border-collapse: collapse; word-break: break-word; } /* Added word-break */
th, td {
    padding: 12px 14px;
    text-align: left;
    font-size: 14px;
    border-bottom: 1px solid #e2e8f0;
}
th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #2d3748;
    position: sticky; top: 0; z-index: 1; /* Added sticky headers */
}
td { background-color: white; }

/* Action cell */
.actions-cell {
    white-space: nowrap;
    text-align: center;
    padding: 8px 12px !important;
}
.actions-cell a, .actions-cell button, .actions-cell form {
    display: inline-block;
    margin: 0 4px;
}

/* Status badge */
.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.status-badge.active   { background: var(--status-active-bg); color: var(--status-active-text); }
.status-badge.inactive { background: var(--status-inactive-bg); color: var(--status-inactive-text); }

/* Messages with fade-in */
.error, .success {
    padding: 14px;
    border-radius: 10px;
    margin: 18px 0;
    font-size: 14px;
    border-left: 5px solid;
    animation: fadeIn 0.3s ease; /* Added */
}
.error   { background: #fee2e2; color: #b91c1c; border-color: var(--danger); }
.success { background: #d1fae5; color: #065f46; border-color: var(--success); }

@keyframes fadeIn { from { opacity:0; transform: translateY(-5px); } to { opacity:1; transform: translateY(0); } }


/* ==================== RESPONSIVE ==================== */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; padding: 20px 16px; }
    .mobile-menu-btn { display: block; }
    .sidebar.active { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }
}

@media (max-width: 768px) {
    .container { padding: 24px; }
    .form-container { padding: 32px; }
    .actions-cell button, .actions-cell a {
        display: block; width: 100%; margin: 6px 0;
    }
    .actions-cell { text-align: left; }
    .display td, .display th {
        padding: 8px 10px !important; font-size: 13px !important;
    }
    .actions-cell { padding: 6px 8px !important; }
    .actions-cell button, .actions-cell a {
        padding: 6px 10px !important; font-size: 12px !important; margin: 4px 0 !important;
    }
    .dataTables_wrapper .dataTables_scrollBody {
        overflow-x: auto !important; -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .container { padding: 20px; }
    .form-container { padding: 24px; }
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
}


/* ==================== MOBILE MENU ==================== */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px; left: 16px;
    z-index: 1100;
    background: #1a202c;
    color: white;
    padding: 12px;
    border-radius: var(--radius);
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.2s ease; /* Added hover scale */
}
.mobile-menu-btn:hover { transform: scale(1.05); } /* Added */

/* Overlay fade effect */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
    transition: opacity 0.3s ease; /* Added */
}

/* ==================== FULL-SCREEN PAGES ==================== */
.login-page, .payment-success-page, .payment-failed-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f0f0f0;
    padding: 20px;
}
.full-screen-container {
    width: 100%;
    max-width: 420px;
    border-radius: 12px; /* Added */
    box-shadow: 0 6px 20px rgba(0,0,0,0.1); /* Added */
    background: #fff; /* Added */
}

/* ==================== BOOTSTRAP PROGRESS ==================== */
.bootstrap-progress-card {
    margin-top:20px;
    background:white;
    padding:20px;
    border-radius:12px;
    box-shadow:0 4px 15px rgba(0,0,0,0.08);
}

.progress-title {
    display:flex;
    align-items:center;
    gap:15px;
    margin-bottom:15px;
}

.progress-title h4 {
    margin:0;
    font-size:18px;
}

#bootstrap-percent {
    font-weight:700;
    font-size:16px;
}

.progress-wrapper {
    width:100%;
}

.progress-container {
    width:100%;
    height:25px;
    background:#e5e7eb;
    border-radius:8px;
    overflow:hidden;
}

#bootstrap-progress-bar {
    height:100%;
    width:0%;
    background:#10825e;
    transition:width .5s ease;
}

.progress-details {
    margin-top:10px;
    font-weight:600;
}

@media (max-width:768px) {

    .progress-title {
        flex-direction:column;
        align-items:flex-start;
        gap:5px;
    }

}
