/* styles/stylenew.css - Shared light/dark theme + navbar + page content styling */
/* Cleaned version: removed aggressive !important overrides on buttons/forms */

/* ────────────────────────────────────────────────
   Color Variables
───────────────────────────────────────────────── */
:root {
    /* Light mode – default */
    --bg-body:        #f8f9fa;
    --text-main:      #212529;
    --text-muted:     #6c757d;
    --bg-section:     #ffffff;
    --border:         #dee2e6;
    --header:         #0d6efd;              /* blue header */
    --accent:         #0d6efd;              /* main blue accent */
    --accent-light:   #e6f0ff;              /* very light blue */
    --link:           #88ccff;
    --link-hover:     #88ccff;
    --table-head:     #e9ecef;
    --table-hover:    #f1f3f5;
    --qual-check:     #0d6efd;
    --no-qual:        #6c757d;

    /* Navbar specific – light */
    --navbar-bg:      #ffffff;
    --navbar-border:  #dee2e6;
    --navbar-text:    #212529;
    --navbar-hover-bg: #e9ecef;
    --navbar-hover-text: #0d6efd;
    --navbar-active:  #0d6efd;
    --dropdown-bg:    #ffffff;
    --dropdown-border: #ccc;
    --dropbtn-bg:     transparent;
    --dropbtn-text:   #212529;
    --dropbtn-hover-bg: #f1f3f5;
}

[data-theme="dark"] {
    /* Dark mode */
    --bg-body:        #0d0f12;
    --text-main:      #e0e0e0;
    --text-muted:     #aaa;
    --bg-section:     #181c20;
    --border:         #2f3740;
    --header:         #66aaff;
    --accent:         #88ccff;
    --accent-light:   #1f2a3a;
    --link:           #88ccff;
    --link-hover:     #88ccff;
    --table-head:     #22272e;
    --table-hover:    #252a30;
    --qual-check:     #88ccff;
    --no-qual:        #888;

    /* Navbar specific – dark */
    --navbar-bg:      #1e2329;
    --navbar-border:  #2f3740;
    --navbar-text:    #e0e0e0;
    --navbar-hover-bg: #252a30;
    --navbar-hover-text: #88ccff;
    --navbar-active:  #66aaff;
    --dropdown-bg:    #1e2329;
    --dropdown-border: #2f3740;
    --dropbtn-bg:     transparent;
    --dropbtn-text:   #e0e0e0;
    --dropbtn-hover-bg: #252a30;
}

/* ────────────────────────────────────────────────
   Navbar
───────────────────────────────────────────────── */
.topnav {
    background-color: var(--navbar-bg);
    overflow: hidden;
    border-bottom: 1px solid var(--navbar-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 900;
}

.topnav a,
.dropbtn {
    float: left;
    color: var(--navbar-text);
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    font-size: 17px;
    transition: 0.3s;
}

.topnav a:hover,
.dropbtn:hover {
    background-color: var(--navbar-hover-bg);
    color: var(--navbar-hover-text);
}

.topnav a.active,
.dropbtn.active {
    background-color: var(--navbar-active);
    color: white;
}

/* Dropdown */
.dropdown {
    float: left;
    overflow: hidden;
}

.dropbtn {
    cursor: pointer;
    font-size: 17px;
    border: none;
    outline: none;
    background-color: var(--dropbtn-bg);
    color: var(--dropbtn-text);
    padding: 14px 16px;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--dropdown-bg);
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border: 1px solid var(--dropdown-border);
    border-radius: 4px;
}

.dropdown-content a {
    float: none;
    color: var(--navbar-text);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
}

.dropdown-content a:hover {
    background-color: var(--navbar-hover-bg);
    color: var(--navbar-hover-text);
}

.dropdown:hover .dropdown-content {
    display: block;
}

.topnav::after {
    content: "";
    clear: both;
    display: table;
}

/* Mobile navbar */
@media screen and (max-width: 768px) {
    .topnav a, .dropdown .dropbtn {
        float: none;
        display: block;
        text-align: left;
    }
    .dropdown { float: none; }
    .dropdown-content { position: relative; box-shadow: none; }
}

/* ────────────────────────────────────────────────
   Theme toggle
───────────────────────────────────────────────── */
#theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1.5rem;
    z-index: 1000;
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    background: var(--table-head);
    color: var(--text-main);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: all 0.2s;
}

#theme-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}

/* ────────────────────────────────────────────────
   General page styles
───────────────────────────────────────────────── */
body {
    background: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    font-family: Arial, sans-serif;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 60px auto;
    padding: 0 40px;
}

h1 {
    text-align: center;
    color: var(--header);
    margin-bottom: 50px;
    font-size: 3em;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-section);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

th, td {
    padding: 20px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--table-head);
    color: var(--text-muted);
    font-weight: bold;
}

tr:hover {
    background: var(--table-hover);
}

/* Flash messages */
.flash-message {
    padding: 14px 24px;
    margin: 25px auto;
    max-width: 880px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
}

.flash-success { background: var(--accent-light); color: #0d6efd; }
.flash-error   { background: #f8d7da; color: #721c24; }
.flash-warning { background: #fff3cd; color: #856404; }

/* Buttons – much less aggressive defaults */
.button,
button[type="submit"],
.btn-edit,
.btn-delete,
.btn-new {
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.2s;
}

.button.primary,
.btn-edit,
.btn-new {
    background: var(--accent);
    color: white;
    border: none;
}

.btn-delete {
    background: #e53e3e;
    color: white;
    border: none;
}

button:hover,
.btn-edit:hover,
.btn-new:hover,
.btn-delete:hover {
    opacity: 0.9;
}

/* Light mode – only override what is truly needed */
[data-theme="light"] {
    --bg-body: #f8f9fa;
    --bg-section: #ffffff;
    --text-main: #212529;
    --text-muted: #6c757d;
    --border: #dee2e6;
    --header: #0d6efd;
}

/* Dark mode */
[data-theme="dark"] {
    --bg-body: #0d0f12;
    --bg-section: #181c20;
    --text-main: #e0e0e0;
    --text-muted: #aaa;
    --border: #2f3740;
    --header: #66aaff;
}

/* Remove or greatly reduce broad overrides */
[data-theme="light"] body,
[data-theme="light"] p,
[data-theme="light"] div,
[data-theme="light"] span,
[data-theme="light"] label,
[data-theme="light"] td,
[data-theme="light"] th {
    color: var(--text-main);
}

/* No more forcing white on all buttons/forms */
[data-theme="light"] .button,
[data-theme="light"] button[type="submit"],
[data-theme="light"] .btn-edit,
[data-theme="light"] .btn-delete,
[data-theme="light"] .btn-new {
    color: inherit !important; /* let inline styles or specific rules win */
}

/* Keep inputs readable */
[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select {
    background: #ffffff;
    color: #212529;
    border-color: #ced4da;
}

[data-theme="light"] input:focus,
[data-theme="light"] textarea:focus,
[data-theme="light"] select:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}
.admin-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    font-size: 1em;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    min-width: 140px;
    text-align: center;
}

/* Light mode defaults */
.admin-btn {
    background: #3b82f6;
    color: white;
    border: 1px solid #2563eb;
}

.admin-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

/* Return to Admin - slightly softer blue */
.return-btn {
    background: #60a5fa;
    border-color: #3b82f6;
}

.return-btn:hover {
    background: #3b82f6;
}

/* Logout - red accent */
.logout-btn {
    background: #ef4444;
    border-color: #dc2626;
}

.logout-btn:hover {
    background: #dc2626;
}

/* Dark mode overrides */
[data-theme="dark"] .admin-btn {
    background: #3b82f6;
    color: white;
    border-color: #60a5fa;
}

[data-theme="dark"] .admin-btn:hover {
    background: #60a5fa;
    box-shadow: 0 4px 12px rgba(96,165,250,0.4);
}

[data-theme="dark"] .return-btn {
    background: #60a5fa;
    border-color: #93c5fd;
}

[data-theme="dark"] .return-btn:hover {
    background: #93c5fd;
}

[data-theme="dark"] .logout-btn {
    background: #f87171;
    border-color: #fca5a5;
}

[data-theme="dark"] .logout-btn:hover {
    background: #fca5a5;
}