/* =========================
ERP SaaS DESIGN SYSTEM
========================= */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;

    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;

    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;

    --radius: 12px;
    --shadow: 0 4px 12px rgba(0,0,0,0.06);
}

/* =========================
GLOBAL RESET (FIXED)
========================= */

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

html, body {
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-text-size-adjust: 100%;
}

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

.wrapper {
    display: flex;
}

/* MAIN CONTENT */
.main {
    margin-left: 260px;
    padding: 20px;
    width: calc(100% - 260px);
    min-height: 100vh;
}

/* =========================
SIDEBAR (UNIFIED)
========================= */

.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: #0f172a;
    color: white;
    padding: 20px;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #38bdf8;
}

.sidebar a {
    display: block;
    padding: 10px 12px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 14px;
}

.sidebar a:hover {
    background: #1e293b;
    color: #fff;
}

/* =========================
TOPBAR (NO HAMBURGER HERE)
========================= */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card);
    padding: 15px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

/* =========================
CARDS (BASE)
========================= */

.card {
    background: var(--card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

/* =========================
KPI DASHBOARD CARDS
========================= */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--card);
    padding: 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: 0.2s;
}

.kpi-card:hover {
    transform: translateY(-3px);
}

.kpi-card h3 {
    font-size: 22px;
}

.kpi-card p {
    font-size: 13px;
    color: var(--muted);
}

/* =========================
BUTTONS
========================= */

.btn {
    background: var(--primary);
    color: white;
    padding: 9px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: 0.2s;
}

.btn:hover {
    background: var(--primary-dark);
}

.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); }

/* =========================
FORMS
========================= */

input, select, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    background: #fff;
}

/* =========================
TABLE SYSTEM (FIXED ONCE)
========================= */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
}

table th {
    text-align: left;
    padding: 12px;
    background: #f3f4f6;
}

table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    word-break: break-word;
}

table tr:hover {
    background: #f9fafb;
}

/* =========================
BADGES
========================= */

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: white;
}

.badge-success { background: var(--success); }
.badge-danger { background: var(--danger); }
.badge-warning { background: var(--warning); }

/* =========================
MODULE GRID
========================= */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 15px;
}

.module-card {
    background: var(--card);
    padding: 15px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* =========================
MOBILE RESPONSIVE (NO HAMBURGER HERE)
========================= */

@media (max-width: 768px) {

    .sidebar {
        left: -270px;
        transition: 0.3s;
    }

    .sidebar.active {
        left: 0;
    }

    .main {
        margin-left: 0;
        width: 100%;
    }

    table thead {
        display: none;
    }

    table, tbody, tr, td {
        display: block;
        width: 100%;
    }

    table tr {
        margin-bottom: 12px;
        background: #fff;
        padding: 10px;
        border-radius: 10px;
        box-shadow: var(--shadow);
    }

    table td {
        border: none;
        padding: 6px 0;
    }

    table td::before {
        content: attr(data-label);
        font-weight: bold;
        color: var(--muted);
        display: block;
        margin-bottom: 4px;
    }
}

/* =========================
SMALL MOBILE
========================= */

@media (max-width: 480px) {
    .btn {
        width: 100%;
    }
}

/* =========================
   LOGIN SYSTEM (PREMIUM SAAS)
========================= */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top left, #2563eb, #0f172a);
    padding: 30px;
}

/* CARD */
.login-card {
    width: 100%;
    max-width:440px;
    background: #ffffff;
    padding: 35px 30px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    text-align: center;
    animation: fadeIn 0.4s ease;
}


/* TITLE */
.login-card h2 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
}

/* SUBTITLE */
.subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 25px;
}

/* FORM GROUP */
.form-group {
    position: relative;
    margin-bottom: 16px;
    width:100%;
}

/* INPUT */
.login-card input {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
    font-size: 14px;
    outline: none;
    transition: 0.2s ease;
}

/* INPUT FOCUS */
.login-card input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

/* PASSWORD ICON */
.form-group span {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 16px;
    color: var(--muted);
}

/* OPTIONS ROW */
.login-card .options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    margin-bottom: 20px;
    color: #475569;
}

.login-card .options a {
    color: var(--primary);
    text-decoration: none;
}

.login-card .options a:hover {
    text-decoration: underline;
}

/* BUTTON */
.btn-login {
    width: 100%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    padding: 13px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(37,99,235,0.3);
}

/* ERROR */
.alert-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 15px;
}

/* ANIMATION */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================
   MOBILE (FIXED + OPTIMIZED)
========================= */


@media (max-width: 768px) {

    .login-card h2 {
        font-size: 18px;
    }

    .subtitle {
        font-size: 12px;
        margin-bottom: 20px;
    }

    .login-card input {
        padding: 14px;
        font-size: 16px; /* ðŸ”¥ prevents iOS zoom */
    }

    .form-group span {
        font-size: 18px;
    }

    .login-card .options {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        font-size: 12px;
    }

    .btn-login {
        padding: 14px;
        font-size: 15px;
    }
}

/* =========================
   SMALL DEVICES (EXTRA FIX)
========================= */

@media (max-width: 400px) {
    .login-card {
        padding: 20px 15px;
    }
}

/* =========================
SIGNATURE / REPORT
========================= */

.signature {
    margin-top: 50px;
    display: flex;
    justify-content: space-between;
}

.signature div {
    text-align: center;
    font-size: 13px;
}

.line {
    width: 180px;
    border-top: 1px solid #000;
    margin-bottom: 5px;
}

.stamp {
    border: 2px dashed var(--primary);
    padding: 15px;
    border-radius: 10px;
    color: var(--primary);
    font-weight: bold;
}


/* =========================
   PAGE CONTAINER
========================= */
.container,
main,
.content {
    max-width: 1200px;
    margin: 30px auto;
    padding: 20px;
}

/* =========================
   HEADER TITLE
========================= */
h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #111827;
}

/* =========================
   FORM FILTER BAR
========================= */
form {
    background: #ffffff;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

form input[type="text"],
form select {
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    outline: none;
    min-width: 180px;
    transition: 0.3s;
    background: #fff;
}

form input:focus,
form select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* =========================
   BUTTONS
========================= */
button,
a.button,
form a {
    background: #3b82f6;
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: 0.3s;
}

button:hover,
a.button:hover,
form a:hover {
    background: #2563eb;
}

/* secondary link button */
form a {
    background: #10b981;
}

form a:hover {
    background: #059669;
}

/* =========================
   TABLE STYLING (SAAS STYLE)
========================= */
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

table thead {
    background: #f3f4f6;
}

table th {
    text-align: left;
    padding: 14px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

table td {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

table tr:hover {
    background: #f9fafb;
}

/* =========================
   ACTION LINKS
========================= */
td a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    margin-right: 6px;
}

td a:hover {
    text-decoration: underline;
}

td a:last-child {
    margin-right: 0;
}

/* danger delete */
td a[href*="delete"] {
    color: #ef4444;
}

/* =========================
   PAGINATION
========================= */
div.pagination,
div[style*="margin-top:15px"] {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

div a {
    padding: 8px 12px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: #374151;
    transition: 0.2s;
}

div a:hover {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

/* =========================
   EMPTY STATE
========================= */
td[colspan] {
    text-align: center;
    padding: 25px;
    color: #6b7280;
}

/* =========================
   RESPONSIVE DESIGN
========================= */
@media (max-width: 768px) {
    form {
        flex-direction: column;
        align-items: stretch;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    h3 {
        font-size: 18px;
    }
}


/* =========================
   PRINCIPAL / HEADMISTRESS DASHBOARD
========================= */

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.2;
}

.page-header p {
    color: var(--muted);
    font-size: 14px;
}

/* =========================
   STATS GRID
========================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border-radius: 14px;
    padding: 22px 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: 0.25s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}

.stat-card h3 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1;
}

.stat-card p {
    font-size: 13px;
    color: var(--muted);
}

.stat-card.danger::before {
    background: var(--danger);
}

/* =========================
   QUICK ACTIONS
========================= */

.quick-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.quick-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    transition: 0.2s ease;
    text-align: center;
}

.quick-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* =========================
   MOBILE RESPONSIVE
========================= */

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .quick-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {

    .page-header h1 {
        font-size: 22px;
    }

    .page-header p {
        font-size: 13px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .quick-links {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 18px 16px;
    }

    .stat-card h3 {
        font-size: 26px;
    }

    .quick-btn {
        min-height: 50px;
        font-size: 13px;
        padding: 12px 14px;
    }
}

@media (max-width: 480px) {

    .page-header {
        margin-bottom: 18px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .stat-card {
        border-radius: 12px;
    }

    .quick-btn {
        border-radius: 10px;
    }
}