/* Global page background helper */
.page-bg {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    color: #1a202c;
    min-height: 100vh;
}

/* Auth pages (login / create password) */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}
.auth-card {
    width: 100%;
    max-width: 460px;
    background: #fff;
    border: none;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}
.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #E94E18;
}
.auth-footer {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: #64748b;
    text-align: center;
}
.form-control {
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    padding: 12px 16px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}
.form-control:focus {
    border-color: #E94E18;
    box-shadow: 0 0 0 3px rgba(233, 78, 24, 0.1);
    outline: none;
}
.form-label {
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.btn-primary {
    border-radius: 12px;
    background: #E94E18;
    border: none;
    padding: 12px 24px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(233, 78, 24, 0.3);
    color: #fff;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 78, 24, 0.4);
    background: #f55a2a;
}
.btn-outline-primary {
    border-radius: 12px;
    border: 2px solid #E94E18;
    color: #E94E18;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
}
.btn-outline-primary:hover {
    background: #E94E18;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(233, 78, 24, 0.3);
}
.btn-outline-secondary {
    border-radius: 12px;
    border: 2px solid #cbd5e1;
    color: #64748b;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
}
.btn-outline-secondary:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #475569;
    transform: translateY(-2px);
}
.btn-outline-danger {
    border-radius: 12px;
    border: 2px solid #ef4444;
    color: #ef4444;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
}
.btn-outline-danger:hover {
    background: #ef4444;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}
.btn-sm {
    padding: 6px 14px;
    font-size: 0.875rem;
    border-radius: 10px;
}

/* Home topbar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: #1e293b;
}
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #E94E18;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(233, 78, 24, 0.3);
}
.btn-logout {
    border-radius: 10px;
    background: #E94E18;
    border: none;
    color: #fff;
    padding: 10px 18px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(233, 78, 24, 0.3);
}
.btn-logout:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(233, 78, 24, 0.4);
    color: #fff;
    background: #f55a2a;
}

/* Layout with sidebar */
.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: calc(100vh - 72px);
    position: relative;
}
.sidebar {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #e2e8f0;
    padding: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 72px;
    height: calc(100vh - 72px);
    overflow: hidden;
}
.sidebar-header {
    background: #1e293b;
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.logo-placeholder {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #E94E18;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.logo-placeholder svg,
.logo-placeholder .sidebar-brand-logo {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}
.logo-placeholder svg {
    stroke: #E94E18;
}
.logo-placeholder .sidebar-brand-logo {
    object-fit: contain;
}
.sidebar-content {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    flex: 1;
    overflow-y: visible;
    height: calc(100vh - 72px - 80px);
}
.sidebar h2 {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #94a3b8;
    margin: 0 0 12px 0;
    font-weight: 700;
}
.nav-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
    position: relative;
}
.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #E94E18;
    transform: translateX(4px);
}
.nav-link.active {
    background: rgba(233, 78, 24, 0.15);
    color: #E94E18;
    border-left: 3px solid #E94E18;
    font-weight: 600;
}

/* Home content */
.page-shell {
    padding: 32px;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
}
.hero {
    background: #fff;
    border: none;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
}
.hero h1 {
    margin: 0 0 8px 0;
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}
.hero p {
    margin: 0;
    color: #64748b;
    font-size: 1rem;
}
.card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    overflow: hidden;
}
.card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}
.card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid #e2e8f0;
    padding: 20px 24px;
    font-weight: 700;
    color: #1e293b;
}
.card-header h2, .card-header h5, .card-header h6 {
    margin: 0;
    font-weight: 700;
    color: #1e293b;
}
.card-body {
    padding: 24px;
}
.alert {
    border-radius: 12px;
    border: none;
    padding: 16px 20px;
    font-weight: 500;
}
.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}
.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-left: 4px solid #22c55e;
}
.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 998;
    animation: fadeIn 0.2s ease;
}
.modal-dialog {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}
.modal-content {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    border: none;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}
.modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}
.modal-body::-webkit-scrollbar {
    width: 8px;
}
.modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 2px solid #e2e8f0;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}
.modal-header h2 {
    margin: 0;
    font-weight: 700;
    color: #1e293b;
    font-size: 1.5rem;
}
.btn-close {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.6;
}
.btn-close:hover {
    background: #f1f5f9;
    opacity: 1;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.signature-pad {
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 12px;
    background: #fff;
}
.signature-pad canvas {
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
}
.signature-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

/* Form improvements */
.form-check {
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.2s ease;
    margin-bottom: 12px;
    background: #fff;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-direction: row;
}
.form-check:hover {
    border-color: #E94E18;
    background: #fff5f2;
    box-shadow: 0 2px 8px rgba(233, 78, 24, 0.1);
}
.form-check-input {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    position: relative;
    background: #fff;
    order: -1;
}
.form-check-input:checked {
    background-color: #E94E18;
    border-color: #E94E18;
}
.form-check-input:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -60%) rotate(45deg);
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    display: block;
}
.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(233, 78, 24, 0.1);
    outline: none;
    border-color: #E94E18;
}
.form-check-label {
    cursor: pointer;
    flex: 1;
    margin: 0;
    padding-top: 2px;
}
.form-check-label strong {
    color: #1e293b;
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.95rem;
}
.form-check-label small {
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.5;
    display: block;
}
.list-group-item {
    border: none;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px;
    transition: all 0.2s ease;
}
.list-group-item:hover {
    background: #f8fafc;
}
.list-group-item:last-child {
    border-bottom: none;
}
.badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.75rem;
}
.badge.bg-primary {
    background: #E94E18 !important;
}
.badge.bg-secondary {
    background: #64748b !important;
}

/* Responsive / tablette-first */
.sidebar-toggle {
    display: none;
    border: 2px solid #e2e8f0;
    background: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    margin-right: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}
.sidebar-toggle:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}
.sidebar-toggle svg {
    width: 20px;
    height: 20px;
    stroke: #475569;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 1024px) {
    .layout {
        display: flex;
        flex-direction: column;
        min-height: calc(100vh - 72px);
    }

    .sidebar {
        position: fixed;
        top: 72px;
        left: 0;
        height: calc(100vh - 72px);
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        overflow-y: auto;
    }
    .sidebar-content {
        height: auto;
        overflow-y: visible;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 72px 0 0 0;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(4px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 999;
    }

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .page-shell {
        padding: 20px;
    }
    
    .hero {
        padding: 24px;
    }
    
    .hero h1 {
        font-size: 1.5rem;
    }
}

/* Icon circle helper */
.icon-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #E94E18;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(233, 78, 24, 0.3);
}

/* Input group improvements */
.input-group-text {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-left: none;
    color: #64748b;
    font-weight: 600;
    border-radius: 0 12px 12px 0;
}

.input-group .form-control {
    border-right: none;
    border-radius: 12px 0 0 12px;
}

.input-group .form-control:focus {
    border-right: 2px solid #E94E18;
}

/* Select improvements */
.form-select {
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    padding: 12px 16px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-size: 16px 12px;
}

.form-select:focus {
    border-color: #E94E18;
    box-shadow: 0 0 0 3px rgba(233, 78, 24, 0.1);
    outline: none;
}

/* Additional modern touches */
.text-muted {
    color: #64748b !important;
}

/* Smooth transitions for all interactive elements */
* {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Better focus states */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #E94E18;
    outline-offset: 2px;
}

/* Loading states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* List group improvements */
.list-group-item-action {
    cursor: pointer;
    border-radius: 8px;
    margin-bottom: 4px;
}

.list-group-item-action:active {
    background: #f1f5f9;
}

/* Badge improvements */
.badge {
    padding: 6px 12px;
    font-size: 0.75rem;
    letter-spacing: 0.025em;
}

/* Shadow utilities */
.shadow-sm {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
}

.shadow {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
}

/* Spacing improvements */
.gap-2 {
    gap: 0.5rem !important;
}

.gap-3 {
    gap: 1rem !important;
}

/* Better table styling if used */
.table {
    border-radius: 12px;
    overflow: hidden;
}

.table thead {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.table td {
    vertical-align: middle;
}

.table form {
    margin: 0;
    display: inline-flex;
    align-items: center;
}

.chrome-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
    padding: 12px 0 0 0;
    background: #f1f5f9;
    border-radius: 12px 12px 0 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.chrome-tabs::-webkit-scrollbar {
    height: 6px;
}

.chrome-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.chrome-tabs::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chrome-tab {
    position: relative;
    display: flex;
    align-items: center;
    padding: 16px 32px;
    background: #e2e8f0;
    border-radius: 12px 12px 0 0;
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    white-space: nowrap;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    min-width: 160px;
    justify-content: center;
}

.chrome-tab:hover {
    background: #cbd5e1;
    color: #475569;
}

.chrome-tab.active {
    background: #fff;
    color: #1e293b;
    font-weight: 600;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    z-index: 1;
}

.chrome-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #E94E18;
}

.chrome-tabs-container {
    background: #fff;
    border-radius: 0 12px 12px 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    width: 100%;
    min-width: 0;
}

.tabs-wrapper {
    margin-bottom: 24px;
}

/* Back button */
.btn-back {
    text-decoration: none;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #f1f5f9;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-back:hover {
    background: #e2e8f0;
    color: #1e293b;
    transform: translateX(-2px);
}

.btn-back svg {
    stroke: currentColor;
}

.badge-geoboost {
    background-color: #00B5B7;
    color: #fff;
}

/* Geoboost theme overrides */
body.theme-geoboost .auth-shell {
    background: linear-gradient(135deg, #1f3a5f 0%, #0d1f3a 100%);
}

body.theme-geoboost .auth-title,
body.theme-geoboost .logo-placeholder,
body.theme-geoboost .nav-link:hover,
body.theme-geoboost .nav-link.active {
    color: #00B5B7;
}

body.theme-geoboost .logo-placeholder svg {
    stroke: #00B5B7;
}

body.theme-geoboost .btn-primary,
body.theme-geoboost .btn-logout,
body.theme-geoboost .avatar,
body.theme-geoboost .icon-circle,
body.theme-geoboost .badge.bg-primary {
    background: #00B5B7 !important;
    box-shadow: 0 4px 15px rgba(0, 181, 183, 0.3);
}

body.theme-geoboost .btn-primary:hover,
body.theme-geoboost .btn-logout:hover {
    background: #00C5C7 !important;
    box-shadow: 0 6px 20px rgba(0, 181, 183, 0.4);
}

body.theme-geoboost .btn-outline-primary {
    border-color: #00B5B7;
    color: #00B5B7;
}

body.theme-geoboost .btn-outline-primary:hover {
    background: #00B5B7;
    color: #fff;
}

body.theme-geoboost .form-control:focus,
body.theme-geoboost .form-select:focus {
    border-color: #00B5B7;
    box-shadow: 0 0 0 3px rgba(0, 181, 183, 0.1);
}

body.theme-geoboost .form-check:hover {
    border-color: #00B5B7;
    background: #ecffff;
    box-shadow: 0 2px 8px rgba(0, 181, 183, 0.1);
}

body.theme-geoboost .form-check-input:checked {
    background-color: #00B5B7;
    border-color: #00B5B7;
}

body.theme-geoboost .form-check-input:focus,
body.theme-geoboost button:focus-visible,
body.theme-geoboost a:focus-visible,
body.theme-geoboost input:focus-visible,
body.theme-geoboost select:focus-visible,
body.theme-geoboost textarea:focus-visible {
    outline-color: #00B5B7;
    border-color: #00B5B7;
}

body.theme-geoboost .nav-link.active {
    background: rgba(0, 181, 183, 0.15);
    border-left-color: #00B5B7;
}

body.theme-geoboost .chrome-tab.active::after {
    background: #00B5B7;
}
