/* ============================================
   COI Portal - Modern UI Styles
   LK Insurance Agency
   ============================================ */

:root {
    --primary: #1a5276;
    --primary-light: #2980b9;
    --primary-dark: #0e2f44;
    --accent: #e67e22;
    --accent-hover: #d35400;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --bg-main: #f0f3f7;
    --bg-card: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-light: #bdc3c7;
    --border: #dce1e8;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    overflow: hidden;
}

.login-header {
    background: var(--primary);
    color: white;
    padding: 35px 30px;
    text-align: center;
}

.login-header .logo-icon {
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 28px;
}

.login-header h1 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 5px;
}

.login-header p {
    font-size: 13px;
    opacity: 0.8;
}

.login-body {
    padding: 35px 30px;
}

.login-body h2 {
    font-size: 20px;
    margin-bottom: 25px;
    color: var(--text-primary);
}

/* ---- FORM ELEMENTS ---- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text-primary);
    background: #fafbfc;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.15);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group .help-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
}

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 82, 118, 0.3);
}

.btn-accent {
    background: var(--accent);
    color: white;
}

.btn-accent:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
}

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

.btn-success:hover {
    background: #219a52;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 15px 32px;
    font-size: 16px;
}

/* ---- LAYOUT ---- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--primary-dark);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.sidebar-header p {
    font-size: 12px;
    opacity: 0.6;
    margin-top: 3px;
}

.sidebar-nav {
    flex: 1;
    padding: 15px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,0.08);
    color: white;
    border-left-color: var(--accent);
}

.sidebar-nav a .icon {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 13px;
    padding: 8px 0;
    transition: var(--transition);
}

.sidebar-footer a:hover {
    color: var(--danger);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
}

/* ---- TOP BAR ---- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.topbar h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar .breadcrumb {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 8px 16px;
    border-radius: 50px;
    box-shadow: var(--shadow);
}

.user-badge .avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.user-badge .user-info {
    font-size: 13px;
}

.user-badge .user-info .name {
    font-weight: 600;
}

.user-badge .user-info .role {
    color: var(--text-secondary);
    font-size: 11px;
}

/* ---- CARDS ---- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 17px;
    font-weight: 600;
}

.card-body {
    padding: 25px;
}

.card-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ---- STAT CARDS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

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

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.blue { background: #eaf2f8; color: var(--primary-light); }
.stat-icon.green { background: #eafaf1; color: var(--success); }
.stat-icon.orange { background: #fef5e7; color: var(--accent); }
.stat-icon.red { background: #fdedec; color: var(--danger); }

.stat-info h4 {
    font-size: 24px;
    font-weight: 700;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ---- TABLE ---- */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead th {
    background: #f4f6f9;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f2f5;
    font-size: 14px;
}

table tbody tr:hover {
    background: #f8f9fb;
}

/* ---- BADGES ---- */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
}

.badge-active {
    background: #eafaf1;
    color: var(--success);
}

.badge-pending {
    background: #fef5e7;
    color: var(--accent);
}

.badge-closed {
    background: #f0f3f7;
    color: var(--text-secondary);
}

.badge-danger {
    background: #fdedec;
    color: var(--danger);
}

/* ---- ALERTS ---- */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #eafaf1;
    color: #1e8449;
    border: 1px solid #a9dfbf;
}

.alert-error {
    background: #fdedec;
    color: #c0392b;
    border: 1px solid #f5b7b1;
}

.alert-info {
    background: #eaf2f8;
    color: #1a5276;
    border: 1px solid #aed6f1;
}

/* ---- SECTION DIVIDER ---- */
.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin: 25px 0 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

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

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ---- LOADING SPINNER ---- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- PDF PREVIEW ---- */
.pdf-preview {
    background: #f0f0f0;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    margin: 20px 0;
}

.pdf-preview .icon {
    font-size: 48px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* ---- VEHICLE TABLE ---- */
.vehicle-list {
    margin-top: 10px;
}

.vehicle-item {
    display: grid;
    grid-template-columns: 80px 1fr 1fr 1fr 100px;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f2f5;
    align-items: center;
    font-size: 14px;
}

.vehicle-item.header {
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border);
}
