/* Synergo Modern UI - Root Variables */
:root {
    --primary: #005bc1;
    --primary-hover: #004899;
    --secondary: #2d3335;
    --background: #f0f4f8;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: rgba(173, 179, 181, 0.2);
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --radius: 1.25rem;
    --radius-sm: 0.75rem;
    --radius-pill: 9999px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-blur: 20px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .font-headline {
    font-family: 'Plus Jakarta Sans', sans-serif;
    letter-spacing: -0.02em;
}

.font-brand {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: -0.035em;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--secondary);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    font-family: 'Manrope', sans-serif;
    color: var(--text-main);
    background-color: #f8f9fa;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.form-control:focus {
    outline: none;
    background-color: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 91, 193, 0.12);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Manrope', sans-serif;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 91, 193, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(0, 91, 193, 0.3);
    transform: translateY(-2px);
}

.btn-block {
    display: block;
    width: 100%;
}

/* Cards */
.card {
    background-color: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    padding: 1.25rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.clickable-row {
    cursor: pointer;
    transition: all var(--transition);
}

.clickable-row:hover {
    background-color: rgba(0, 91, 193, 0.04);
}

.clickable-row:active {
    background-color: rgba(0, 91, 193, 0.08);
}

/* Status Pills */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-neutral { background: #f1f4f5; color: #5a6062; }

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}
.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
}

/* Authentication Layout */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    background: #f0f4f8;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: rgba(0, 91, 193, 0.06);
    border-radius: 50%;
    z-index: 0;
}

.auth-wrapper::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 250px;
    height: 250px;
    background: rgba(0, 91, 193, 0.04);
    border-radius: 50%;
    z-index: 0;
}

.auth-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    padding: 3rem 2.5rem;
    border-radius: 1.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.5);
    width: 100%;
    max-width: 440px;
    z-index: 10;
    position: relative;
}

@media (max-width: 640px) {
    .auth-wrapper {
        padding: 1.25rem 0.75rem;
    }
    .auth-card {
        padding: 2rem 1.25rem;
        border-radius: 1.25rem;
    }
}

.auth-logo {
    text-align: center;
    margin-bottom: 2.5rem;
}
.auth-logo h1 {
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.auth-logo p {
    color: var(--text-muted);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 100050;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    padding: 1rem;
    box-sizing: border-box;
}

.modal-backdrop.show {
    display: flex;
    opacity: 1;
}

.modal-dialog {
    background: var(--surface);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: calc(100vh - 3rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: auto;
}

.modal-backdrop.show .modal-dialog {
    transform: scale(1) translateY(0);
}

.modal-dialog > form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    margin: 0;
}

.modal-header {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: #ffffff;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f1f5f9;
    color: var(--danger);
}

.modal-body {
    padding: 1.5rem 1.75rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.modal-footer {
    padding: 1rem 1.75rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #f8fafc;
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    flex-shrink: 0;
}

/* =========================================================================
   UNIVERSAL ADAPTIVE MOBILE BOTTOM SHEET MODALS (iOS / Android Native Feel)
   ========================================================================= */
@keyframes modalSheetSlideUp {
    from {
        transform: translateY(105%);
        opacity: 0.85;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .modal-backdrop,
    body .modal-backdrop {
        align-items: flex-end !important;
        justify-content: center !important;
        padding: 0 !important;
        z-index: 100050 !important;
        background: rgba(15, 23, 42, 0.58) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        backdrop-filter: blur(8px) !important;
        overflow: hidden !important;
    }

    .modal-dialog,
    body .modal-dialog {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        border-radius: 24px 24px 0 0 !important;
        border: none !important;
        border-top: 1px solid rgba(226, 232, 240, 0.85) !important;
        box-shadow: 0 -14px 44px rgba(0, 0, 0, 0.22) !important;
        max-height: 90vh !important;
        max-height: 90dvh !important;
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
        transform: translateY(105%) !important;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease !important;
        overflow: hidden !important;
    }

    /* Subtle Grabber Pill indicator atop the sheet */
    .modal-dialog::before,
    body .modal-dialog::before {
        content: '' !important;
        display: block !important;
        width: 38px !important;
        height: 4.5px !important;
        background: #cbd5e1 !important;
        border-radius: 999px !important;
        margin: 10px auto 4px auto !important;
        flex-shrink: 0 !important;
    }

    .modal-backdrop.show .modal-dialog,
    body .modal-backdrop.show .modal-dialog {
        transform: translateY(0) !important;
        animation: modalSheetSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
    }

    .modal-header,
    body .modal-header {
        padding: 0.75rem 1.25rem 0.75rem 1.25rem !important;
        border-bottom: 1px solid var(--border) !important;
        flex-shrink: 0 !important;
        background: #ffffff !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .modal-title,
    body .modal-title {
        font-size: 1.15rem !important;
        line-height: 1.35 !important;
        font-weight: 700 !important;
    }

    .modal-close,
    body .modal-close {
        width: 36px !important;
        min-width: 36px !important;
        height: 36px !important;
        min-height: 36px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        background: #f1f5f9 !important;
        color: #475569 !important;
        border: none !important;
        transition: background-color 0.2s ease, transform 0.15s ease !important;
    }

    .modal-close:active,
    body .modal-close:active {
        transform: scale(0.92) !important;
        background: #e2e8f0 !important;
    }

    .modal-body,
    body .modal-body {
        padding: 1.25rem 1.25rem !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
    }

    .modal-footer,
    body .modal-footer {
        padding: 0.85rem 1.25rem max(1.25rem, calc(0.85rem + env(safe-area-inset-bottom, 0px))) 1.25rem !important;
        border-top: 1px solid var(--border) !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        background: #ffffff !important;
        flex-shrink: 0 !important;
        gap: 0.65rem !important;
    }

    /* Form controls in modal: prevent auto-zoom on iOS Safari */
    .modal-dialog input,
    .modal-dialog select,
    .modal-dialog textarea {
        font-size: 16px !important;
    }

    /* Auto-hide floating navigation capsule while any modal or bottom sheet is open */
    body.modal-open .floating-nav-container,
    body:has(.modal-backdrop.show) .floating-nav-container {
        transform: translateY(calc(100% + 5rem)) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        visibility: hidden !important;
    }
}

