/* =====================
   GLOBAL RESET
===================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #f3f6fb;
    color: #1f2937;
}

/* =====================
   DARK MODE
===================== */
body.dark {
    background: #0f172a;
    color: #e5e7eb;
}

.theme-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}

.theme-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Cards */
body.dark .upload-card,
body.dark .table-wrapper,
body.dark .login-card,
body.dark .modal-card {
    background: #1e293b;
    color: #e5e7eb;
}

body.dark .topbar {
    background: linear-gradient(135deg, #020617, #020617);
    box-shadow: 0 12px 28px rgba(0,0,0,0.6);
}

/* Inputs */
body.dark input {
    background: #0f172a;
    color: #e5e7eb;
    border-color: #334155;
}

body.dark input::placeholder {
    color: #94a3b8;
}

/* Table */
body.dark th {
    background: #1e40af;
}

body.dark td {
    border-color: #334155;
}

body.dark tbody tr:hover {
    background: #020617;
}

/* Modals */
body.dark .modal {
    background: rgba(2,6,23,0.85);
}

/* Buttons */
body.dark .secondary {
    background: #475569;
}

body.dark .secondary:hover {
    background: #334155;
}

body.dark #logoutConfirmModal .modal-card {
    background: #020617;
}

body.dark #logoutConfirmModal p {
    color: #e5e7eb;
}

body.dark #editModal .modal-card {
    background: #020617;
}

body.dark #editModal h3 {
    color: #e5e7eb;
}

body.dark .error-msg {
    color: #f87171;
}

.app {
    max-width: 1300px;
    margin: auto;
    padding: 20px;
}

.add-row input,
#searchBox {
    text-transform: uppercase;
}

input[type="password"],
input[type="email"],
input[type="text"]:not(.add-row),
input::placeholder {
    text-transform: none !important;
}

/* =====================
   BUTTONS
===================== */
.btn {
    padding: 10px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.primary {
    background: #2563eb;
    color: #fff;
}
.primary:hover {
    background: #1e4ed8;
}

.secondary {
    background: #64748b;
    color: #fff;
}
.secondary:hover {
    background: #475569;
}

.danger {
    background: #dc2626;
    color: #fff;
}
.danger:hover {
    background: #b91c1c;
}

.success {
    background: #16a34a;
    color: #fff;
}
.success:hover {
    background: #15803d;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* =====================
   TOPBAR
===================== */
.topbar-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    overflow: hidden;
}

.topbar-actions-wrapper {
    display: flex;
    align-items: center;
    gap: 32px;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
    pointer-events: none;
}

.topbar-actions-wrapper:not(.is-hidden) {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.topbar-actions-wrapper.is-hidden {
    transform: translateX(120%);
    opacity: 0;
    pointer-events: none;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.35);
    margin-bottom: 22px;
}

.topbar-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.topbar-toggle {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 20px;
    padding: 10px 14px;
    margin-left: auto;
    flex-shrink: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.6s ease;
}

.topbar-controls.active .topbar-toggle {
    transform: translateX(-12px);
}

.app-title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.app-subtitle {
    font-size: 13px;
    opacity: 0.85;
    font-weight: 500;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar .btn {
    padding: 10px 18px;
    font-size: 14px;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.topbar .btn.primary {
    background: #22c55e;
}

.topbar .btn.primary:hover {
    background: #16a34a;
}

.topbar .btn.danger {
    background: #ef4444;
}

.topbar .btn.danger:hover {
    background: #dc2626;
}

.theme-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 18px;
    cursor: pointer;
    color: #fff;
    transition: all 0.2s ease;
}

.theme-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* =====================
   SEARCH UI
===================== */
.search-container {
    display: flex;
    justify-content: center;
    margin: 20px 0 24px;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 520px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 42px; /* left padding for search icon */
    border-radius: 999px;
    border: 2px solid #c7d2fe;
    font-size: 15px;
    font-weight: 600;
    background: #ffffff;
}

.search-box .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0.6;
    pointer-events: none;
}

#searchBox {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border-radius: 999px;
    border: 2px solid #c7d2fe;
    font-size: 15px;
    font-weight: 600;
    background: #ffffff;
    transition: all 0.25s ease;
}

#searchBox::placeholder {
    font-weight: 500;
    color: #64748b;
}

#searchBox:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.18);
}

#clearSearchBtn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

#clearSearchBtn:hover {
    opacity: 1;
}

mark {
    background: #ffe066;
    padding: 2px 4px;
    border-radius: 4px;
}

/* =====================
   ADMIN UPLOAD CARD
===================== */
.upload-card {
    max-width: 420px;
    margin: 15px auto;
    background: #ffffff;
    padding: 16px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    text-align: center;
}

.file-name {
    display: block;
    margin: 8px 0;
    font-size: 14px;
    color: #555;
}

.section-separator {
    margin: 32px 0 24px 0;  
    text-align: center;
}

.section-separator hr {
    border: none;
    border-top: 2px solid #e2e8f0;  
    width: 100%;
}

.full-width {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
}

/* =====================
   UPLOAD PROGRESS
===================== */
.progress {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 10px;
}

#progressBar {
    width: 0%;
    height: 100%;
    background: #2563eb;
    transition: width 0.3s ease;
}

.upload-msg {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #15803d;
}

/* =====================
   SEARCH BAR
===================== */
.toolbar {
    display: flex;
    justify-content: flex-start;
    margin: 15px 0;
}

.toolbar input {
    width: 100%;       
    max-width: none;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #cbd5f5;
    font-size: 14px;
    transition: all 0.2s ease;
}

.toolbar input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}

.toolbar input:hover {
    border-color: #2563eb;
}

/* =====================
   TABLE
===================== */
.table-wrapper {
    background: #ffffff;
    border-radius: 10px;
    overflow-x: auto;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    border: 1px solid #e5e7eb;
    padding: 10px;
    text-align: left;
    font-size: 14px;
}

th {
    background: #2563eb;
    color: #ffffff;
    cursor: pointer;
    user-select: none;
    text-align: center;   
    vertical-align: middle; 
}

th:hover {
    background: #3b82f6;     
}

tbody tr:hover {
    background: #f8fafc;  
}

/* =====================
   PAGINATION
===================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
}

/* =====================
   MODALS
===================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 1000;
}

.modal-card {
    background: #ffffff;
    padding: 30px;
    border-radius: 10px;
    width: 300px;
    max-width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-card.wider {
    width: 502px;
    max-width: 95%;
    padding: 32px;
}

.modal-card h3 {
    margin-top: 0;
    text-align: center;
    margin-bottom: 24px;
    font-size: 20px;
}

.modal-card input {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 16px;    
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-size: 15px;
    box-sizing: border-box;
}

.modal-card input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-card input::placeholder {
    color: #6b7280;
    font-weight: 500;
}

.input-wrap {
    position: relative;
    margin-bottom: 14px;
}

.error-msg {
    display: none;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #dc2626;
}

input.error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220,38,38,0.15);
}

.modal-card .button-group {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
}

.modal-card .button-group .btn {
    flex: none;
    min-width: 80px;
}

/* =====================
   ADMIN LOGIN MODAL
===================== */
.login-card {
    background: #ffffff;
    width: 360px;
    max-width: 92%;
    border-radius: 18px;
    padding: 32px 28px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
    animation: scaleFade 0.25s ease;
}

/* Header */
.login-header {
    text-align: center;
    margin-bottom: 26px;
}

.login-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    box-shadow: 0 10px 25px rgba(37,99,235,0.45);
}

.login-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: #1e293b;
}

.login-header p {
    margin-top: 6px;
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

/* Body */
.login-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Edit Modal */
/* =====================
   EDIT MODAL UI
===================== */
#editModal .modal-card {
    border-radius: 18px;
    box-shadow: 0 35px 90px rgba(0,0,0,0.35);
}

#editModal h3 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 28px;
    color: #1e293b;
}

/* Input spacing & feel */
#editModal input {
    border-radius: 12px;
    font-weight: 600;
    padding: 14px 16px;
}

/* Buttons */
#editModal .button-group {
    justify-content: flex-end;
    gap: 14px;
}

#editModal .btn.primary {
    padding: 14px 26px;
    border-radius: 999px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 2px solid #c7d2fe;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.25s ease;
}

.input-group input::placeholder {
    color: #64748b;
    font-weight: 500;
}

.input-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 5px rgba(37,99,235,0.18);
}

/* Actions */
.login-actions {
    display: flex;
    gap: 12px;
    margin-top: 26px;
}

.login-actions .btn {
    flex: 1;
    padding: 12px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
}

.password-group {
    position: relative;
}

.password-group .toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 18px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.password-group .toggle-password:hover {
    opacity: 1;
}
/* Animation */
@keyframes scaleFade {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* =====================
   LOGOUT MODAL UI
===================== */
#logoutConfirmModal .modal-card {
    width: 380px;
    padding: 32px 28px;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0,0,0,0.35);
    animation: scaleFade 0.25s ease;
}

#logoutConfirmModal p {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 24px;
}

#logoutConfirmModal .button-group {
    display: flex;
    gap: 14px;
}

#logoutConfirmModal .btn {
    flex: 1;
    padding: 14px;
    font-size: 15px;
    border-radius: 999px;
}

/* =====================
   UTILITIES
===================== */
.hidden {
    display: none;
}

.modal-card.wider-delete {
    width: 520px;  
    max-width: 95%;
    padding: 36px;
}

.delete-confirm-message {
    text-align: center;
    font-size: 17px;
    line-height: 1.6;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 28px;
}

.delete-confirm-message p {
    margin: 0 0 16px 0;
}

.container-highlight {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fee2e2;
    color: #991b1b;
    padding: 16px 28px;
    border-radius: 10px;
    border: 2px solid #fca5a5;
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.15);
    font-size: 24px;
    font-weight: 800;
    gap: 8px;
}

.question-mark {
    font-size: 28px;
    font-weight: 700;
    margin-left: 4px;
}

.action-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 9999;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success { background: #28a745; }
.toast.error { background: #dc3545; }
.toast.warn { background: #f39c12; }

/* FOOTER */
.site-footer {
    background: #003366;     
    color: #ffffff;
    padding: 20px 40px;
    font-family: Arial, sans-serif;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-left p {
    margin: 0;
    font-weight: bold;
    font-size: 1rem;
}

.footer-right a {
    color: #ffffff;
    margin-left: 20px;
    text-decoration: none;
    position: relative;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-right a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 100%;
    height: 2px;
    background: #ffcc00;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.footer-right a:hover::after {
    transform: scaleX(1);
}

.footer-right a:hover {
    color: #ffcc00;  
}

/* =====================
   RESPONSIVE (TABLET & BELOW)
===================== */
@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }

    /* Smaller fonts */
    .app-title {
        font-size: 16px;
    }

    .app-subtitle {
        font-size: 11px;
    }

    /* Controls go bottom, centered */
    .topbar-controls {
        width: 100%;
        display: flex;
        justify-content: center;
        gap: 12px;
    }

    /* Actions open INLINE (not floating) */
    .topbar-actions-wrapper {
        transform: scaleY(0);
        transform-origin: top;
        opacity: 0;
        max-height: 0;
        overflow: hidden;
        transition: all 0.4s ease;
    }

    .topbar-actions-wrapper:not(.is-hidden) {
        transform: scaleY(1);
        opacity: 1;
        max-height: 200px;
    }

    /* Buttons spacing */
    .topbar-right {
        gap: 14px;
    }

    #loginBtn,
    #logoutBtn {
        width: auto;
    }

    .search-box {
        width: 100%;
        max-width: 100%;
    }

    .footer-container {
        flex-direction: column;
        align-items: center;  
        text-align: center;
    }
    
    .footer-left {
        margin-bottom: 15px;
        font-size: 0.8;      
    }
    
    .footer-right {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;    
        gap: 20px;           
        margin-top: 0;
    }
    
    .footer-right a {
        margin-left: 0;
        margin-right: 0; 
    }

}
