/* ============================================================
   Kerala Lottery Documents CRM - Main Stylesheet
   ============================================================ */

:root {
    --primary: #0f4c81;
    --primary-dark: #0a3760;
    --primary-light: #1668ab;
    --accent: #e8a33d;
    --accent-dark: #cf8a26;
    --success: #1d9d6f;
    --danger: #d6453d;
    --warning: #e6a417;
    --bg: #f4f6f9;
    --card-bg: #ffffff;
    --text-dark: #1c2733;
    --text-muted: #6b7785;
    --border: #e3e7ed;
    --radius: 14px;
    --shadow: 0 4px 16px rgba(15, 76, 129, 0.08);
    --shadow-hover: 0 8px 24px rgba(15, 76, 129, 0.14);
}

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

body {
    font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-dark);
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ---------------- Login Page ---------------- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 420px;
    padding: 40px 32px;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-logo {
    text-align: center;
    margin-bottom: 8px;
}

.login-logo .icon-circle {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: #fff;
    box-shadow: 0 6px 16px rgba(232, 163, 61, 0.4);
}

.login-card h1 {
    text-align: center;
    font-size: 22px;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 13.5px;
    margin-bottom: 28px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fbfcfe;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(22, 104, 171, 0.12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 22px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    width: 100%;
    box-shadow: 0 6px 16px rgba(15, 76, 129, 0.25);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(15, 76, 129, 0.32); }

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
}
.btn-accent:hover { transform: translateY(-1px); }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #b8392f; }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-dark);
}
.btn-outline:hover { border-color: var(--primary-light); color: var(--primary); }

.btn-sm { padding: 7px 14px; font-size: 13px; }

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 18px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-danger { background: #fdebe9; color: #a8291f; border: 1px solid #f7c9c4; }
.alert-success { background: #e4f6ee; color: #136b48; border: 1px solid #b9e8d3; }
.alert-warning { background: #fef6e3; color: #8a5c0a; border: 1px solid #fae3a8; }
.alert-info { background: #e7f1fb; color: #0f4c81; border: 1px solid #c2dcf2; }

.login-footer-note {
    text-align: center;
    margin-top: 22px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ---------------- App Shell / Layout ---------------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--primary-dark), var(--primary));
    color: #fff;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.sidebar-brand .icon-circle {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.3;
}

.sidebar-brand .brand-text span {
    display: block;
    font-size: 11px;
    font-weight: 400;
    opacity: 0.7;
}

.sidebar-nav {
    padding: 16px 12px;
}

.sidebar-nav li { margin-bottom: 4px; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    transition: background 0.15s;
}

.sidebar-nav a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-nav a.active { background: var(--accent); color: #fff; }

.sidebar-nav .nav-icon { font-size: 17px; width: 20px; text-align: center; }

.main-content {
    flex: 1;
    margin-left: 250px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--card-bg);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar h2 {
    font-size: 19px;
    color: var(--text-dark);
}

.topbar .topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--primary);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    padding: 8px 14px;
    border-radius: 24px;
    font-size: 13.5px;
    font-weight: 600;
}

.user-chip .dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
}

.page-content {
    padding: 28px;
    flex: 1;
}

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

.page-header h1 {
    font-size: 24px;
    color: var(--text-dark);
    margin-bottom: 4px;
}

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

/* ---------------- Cards / Grid ---------------- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.grid {
    display: grid;
    gap: 20px;
}

.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }

.module-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.module-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 20px;
    text-align: center;
    cursor: not-allowed;
    position: relative;
    opacity: 0.72;
    border: 2px solid transparent;
    transition: box-shadow 0.2s;
}

.module-card .module-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    font-size: 26px;
    color: #fff;
}

.module-card h3 {
    font-size: 16px;
    margin-bottom: 6px;
    color: var(--text-dark);
}

.module-card .module-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: #eef1f5;
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 20px;
    margin-top: 4px;
}

.module-card.color-1 .module-icon { background: linear-gradient(135deg, #1668ab, #0f4c81); }
.module-card.color-2 .module-icon { background: linear-gradient(135deg, #1d9d6f, #157854); }
.module-card.color-3 .module-icon { background: linear-gradient(135deg, #e8a33d, #cf8a26); }
.module-card.color-4 .module-icon { background: linear-gradient(135deg, #d6453d, #b8392f); }
.module-card.color-5 .module-icon { background: linear-gradient(135deg, #7b5fd1, #6347b8); }
.module-card.color-6 .module-icon { background: linear-gradient(135deg, #2a9fa8, #237f87); }

.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 26px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    flex-shrink: 0;
}

.stat-card .stat-icon.blue { background: linear-gradient(135deg, #1668ab, #0f4c81); }
.stat-card .stat-icon.green { background: linear-gradient(135deg, #1d9d6f, #157854); }
.stat-card .stat-icon.orange { background: linear-gradient(135deg, #e8a33d, #cf8a26); }
.stat-card .stat-icon.red { background: linear-gradient(135deg, #d6453d, #b8392f); }

.stat-card .stat-value { font-size: 22px; font-weight: 700; color: var(--text-dark); }
.stat-card .stat-label { font-size: 12.5px; color: var(--text-muted); }

/* ---------------- Tables ---------------- */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 13.5px;
}

table th {
    background: #f0f3f7;
    text-align: left;
    padding: 13px 16px;
    font-weight: 700;
    color: var(--text-dark);
    white-space: nowrap;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-dark);
    vertical-align: middle;
}

table tr:last-child td { border-bottom: none; }
table tr:hover td { background: #fafbfd; }

.badge {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success { background: #e4f6ee; color: #136b48; }
.badge-danger { background: #fdebe9; color: #a8291f; }
.badge-warning { background: #fef6e3; color: #8a5c0a; }
.badge-info { background: #e7f1fb; color: #0f4c81; }
.badge-muted { background: #eef1f5; color: var(--text-muted); }

.ip-mono {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: #f0f3f7;
    padding: 3px 9px;
    border-radius: 6px;
}

/* ---------------- Forms / Settings ---------------- */
.settings-section {
    max-width: 520px;
}

.settings-section h3 {
    font-size: 16px;
    margin-bottom: 18px;
    color: var(--text-dark);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 32, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show { display: flex; }

.modal-box {
    background: #fff;
    border-radius: var(--radius);
    max-width: 480px;
    width: 100%;
    padding: 28px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    animation: slideUp 0.3s ease;
}

.modal-box h3 { margin-bottom: 16px; font-size: 18px; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; justify-content: flex-end; }

footer.app-footer {
    text-align: center;
    padding: 18px;
    font-size: 12.5px;
    color: var(--text-muted);
}

/* ---------------- Mobile Responsive ---------------- */
@media (max-width: 900px) {
    .module-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0,0,0,0.2);
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .topbar { padding: 14px 16px; }
    .topbar h2 { font-size: 16px; }
    .page-content { padding: 16px; }
    .module-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .module-card { padding: 18px 10px; }
    .module-card .module-icon { width: 44px; height: 44px; font-size: 20px; }
    .module-card h3 { font-size: 13px; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 18px; }
    .login-card { padding: 30px 22px; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 99;
    }
    .sidebar-overlay.show { display: block; }
    .user-chip span.username-text { display: none; }
}

@media (max-width: 480px) {
    .module-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-cards { grid-template-columns: 1fr 1fr; }
    table { font-size: 12.5px; }
    table th, table td { padding: 10px 10px; }
}
