/* ============================================
   Racy Portal - Ana Stil Dosyasi
   ============================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #3b82f6;
    --navbar-height: 60px;
    --body-bg: #f1f5f9;
}

/* --- Genel --- */
body {
    background-color: var(--body-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* --- Auth Sayfalari --- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.auth-wrapper .card {
    border: none;
    border-radius: 12px;
}

.auth-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: 1px;
}

/* --- Sidebar Layout --- */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #cbd5e1;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

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

.sidebar-brand h5 {
    color: #fff;
    margin: 0;
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    background: var(--sidebar-active);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: #fff;
    font-size: 1.1rem;
}

.sidebar-menu {
    padding: 12px 0;
}

.sidebar-menu .menu-label {
    padding: 8px 20px 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #64748b;
    font-weight: 600;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-menu a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-menu a.active {
    background: rgba(59, 130, 246, 0.15);
    color: #fff;
    border-left-color: var(--sidebar-active);
}

.sidebar-menu a i {
    width: 20px;
    margin-right: 10px;
    text-align: center;
    font-size: 1rem;
}

/* --- Main Content --- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
}

.top-navbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 24px;
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

.top-navbar .nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-navbar .nav-user .user-avatar {
    width: 36px;
    height: 36px;
    background: var(--sidebar-active);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
}

.content-area {
    padding: 24px;
}

/* --- Sidebar Toggle (Mobile) --- */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #475569;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }
}

/* --- Card Stilleri --- */
.card {
    border-radius: 10px;
}

.card-header {
    border-radius: 10px 10px 0 0 !important;
}

/* --- Tablo Stilleri --- */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}

/* --- Stat Kartlari --- */
.stat-card {
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

/* --- Error Sayfasi --- */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.error-page .error-code {
    font-size: 6rem;
    font-weight: 800;
    color: #e2e8f0;
    line-height: 1;
}

/* --- Ortak Modül Bileşenleri --- */
.module-card {
    border: 0;
    border-radius: 12px;
    box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.08);
}

.module-card .module-card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
    padding: 0.85rem 1rem;
    font-weight: 600;
}

.module-table thead th {
    background: #f8fafc;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.action-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
}

.form-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

.form-grid > .span-3 { grid-column: span 3; }
.form-grid > .span-4 { grid-column: span 4; }
.form-grid > .span-6 { grid-column: span 6; }
.form-grid > .span-8 { grid-column: span 8; }
.form-grid > .span-12 { grid-column: span 12; }

@media (max-width: 992px) {
    .form-grid > [class*="span-"] {
        grid-column: span 12;
    }
}

/* --- Aramali Secim Bileseni --- */
.search-select {
    position: relative;
}

.search-select .search-select-results {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    z-index: 1085;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 0.35rem 0.8rem rgba(15, 23, 42, 0.15);
}

.search-select .search-select-selected {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: #64748b;
}

/* --- PWA Banner --- */
.pwa-notice-wrap {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.pwa-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.75rem;
    background: #ffffff;
    box-shadow: 0 0.15rem 0.55rem rgba(15, 23, 42, 0.08);
}

.pwa-notice-title {
    margin: 0;
    font-size: 0.87rem;
    font-weight: 600;
    color: #0f172a;
}

.pwa-notice-sub {
    margin: 0;
    font-size: 0.78rem;
    color: #475569;
}

.pwa-notice-actions {
    display: inline-flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.pwa-notice-wrap-auth {
    max-width: 780px;
    margin: 0 auto 1rem;
}

/* --- Form Submit Loading --- */
form.is-submitting button[type="submit"],
form.is-submitting input[type="submit"] {
    cursor: wait;
}

/* --- Mobil Tablo -> Kart Satiri --- */
@media (max-width: 768px) {
    .content-area {
        padding: 16px;
    }

    .table-responsive {
        overflow: visible;
    }

    .table.mobile-stack-table {
        margin-bottom: 0;
        border-collapse: separate;
        border-spacing: 0;
    }

    .table.mobile-stack-table thead {
        display: none;
    }

    .table.mobile-stack-table tbody,
    .table.mobile-stack-table tr,
    .table.mobile-stack-table td {
        display: block;
        width: 100%;
    }

    .table.mobile-stack-table tr {
        border: 1px solid #e2e8f0;
        border-radius: 0.85rem;
        background: #fff;
        padding: 0.45rem 0.7rem;
        margin: 0.55rem 0.4rem;
        box-shadow: 0 0.2rem 0.7rem rgba(15, 23, 42, 0.06);
    }

    .table.mobile-stack-table td {
        border: 0 !important;
        padding: 0.38rem 0;
        display: flex;
        gap: 0.8rem;
        align-items: flex-start;
        justify-content: space-between;
    }

    .table.mobile-stack-table td::before {
        content: attr(data-label);
        font-size: 0.73rem;
        letter-spacing: 0.02em;
        text-transform: uppercase;
        color: #64748b;
        font-weight: 600;
        min-width: 38%;
        max-width: 50%;
    }

    .table.mobile-stack-table td.mobile-action-cell {
        justify-content: flex-end;
        padding-top: 0.6rem;
    }

    .table.mobile-stack-table td.mobile-action-cell::before {
        display: none;
    }

    .table.mobile-stack-table td.mobile-action-cell form {
        margin: 0;
    }

    .table.mobile-stack-table td.mobile-action-cell .btn {
        min-width: 2rem;
    }

    .pwa-notice {
        align-items: flex-start;
        flex-direction: column;
    }

    .pwa-notice-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* --- Servis Detay Mobil Baslik --- */
.service-show-header {
    gap: 0.75rem;
}

.service-show-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .service-show-header {
        align-items: flex-start !important;
    }

    .service-show-title {
        min-width: 0;
    }

    .service-show-title h4 {
        font-size: 1rem;
        line-height: 1.25;
    }

    .service-show-title small {
        display: block;
        line-height: 1.2;
    }

    .service-show-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .service-show-actions .btn {
        width: 2.1rem;
        height: 2.1rem;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .service-show-actions .btn-label {
        display: none;
    }
}

/* --- Servis Form Mobil Katlanir Kartlar --- */
.service-form-section .mobile-section-toggle {
    display: none;
}

@media (max-width: 768px) {
    .service-form-section .mobile-section-toggle {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        font-size: 0.85rem;
        padding: 0.2rem 0.3rem;
    }
}

/* --- Mobil FAB Hızlı İşlemler --- */
.mobile-quick-fab-wrap {
    display: none;
}

.mobile-quick-fab-btn {
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #0f766e, #0284c7);
    color: #fff;
    box-shadow: 0 0.65rem 1.2rem rgba(2, 132, 199, 0.32);
}

@media (max-width: 768px) {
    .mobile-quick-fab-wrap {
        display: block;
    }

    .mobile-quick-fab-btn-header {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.35rem;
        height: 2.35rem;
        padding: 0;
        font-size: 1rem;
        flex: 0 0 auto;
    }

    .mobile-quick-fab-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.38);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.22s ease;
        z-index: 1090;
    }

    .mobile-quick-fab-menu {
        position: fixed;
        top: calc(var(--navbar-height) + 0.55rem);
        right: 0.7rem;
        left: auto;
        bottom: auto;
        transform: translateY(-12px);
        width: calc(100% - 1.4rem);
        max-width: 440px;
        max-height: calc(100vh - var(--navbar-height) - 1.2rem);
        overflow-y: auto;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 1rem;
        padding: 0.8rem;
        box-shadow: 0 0.8rem 2rem rgba(15, 23, 42, 0.2);
        z-index: 1101;
        opacity: 0;
        pointer-events: none;
        transition: transform 0.22s ease, opacity 0.22s ease;
    }

    .mobile-quick-fab-menu .btn {
        text-align: left;
        justify-content: flex-start;
    }

    body.quick-fab-open .mobile-quick-fab-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    body.quick-fab-open .mobile-quick-fab-menu {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    body.quick-fab-open .mobile-quick-fab-btn-header {
        box-shadow: 0 0.8rem 2.2rem rgba(15, 23, 42, 0.34);
    }
}

/* --- Servis Imza Sayfasi --- */
.signature-canvas {
    display: block;
    width: 100%;
    min-height: 220px;
    border-bottom: 2px solid #dee2e6;
    cursor: crosshair;
    touch-action: none;
    background: #fff;
}

.sign-mobile-signature-actions {
    display: none;
}

.signature-modal .modal-body {
    padding: 0.75rem;
}

@media (max-width: 768px) {
    .sign-desktop-signature-row {
        display: none;
    }

    .sign-mobile-signature-actions {
        display: block;
    }

    .signature-modal .modal-content {
        border-radius: 0;
        min-height: 100dvh;
    }

    .signature-modal .modal-body {
        display: flex;
        align-items: stretch;
        padding: 0.6rem;
        overflow: hidden;
    }

    .signature-canvas.signature-canvas-mobile {
        flex: 1 1 auto;
        min-height: 0;
        border: 1px solid #cbd5e1;
        border-radius: 0.75rem;
    }

    .signature-modal .modal-footer .btn {
        flex: 1 1 auto;
    }
}
