:root {
    --rp-primary: #012269;
    --rp-primary-light: #0a3a8f;
    --rp-primary-dark: #011a4f;
    --rp-accent: #2575fc;
    --rp-accent-light: #4d8ffd;
    --rp-red: #C92B28;
    --rp-red-light: #e8472a;
    --rp-green: #17c653;
    --rp-yellow: #f6c000;
    --rp-orange: #fd7e14;
    --rp-gray-100: #f5f6f8;
    --rp-gray-200: #e9ecef;
    --rp-gray-500: #7D7D7D;
    --rp-white: #ffffff;
}

body {
    font-family: 'Poppins', sans-serif !important;
}

[data-bs-theme="light"] {
    --bs-body-bg: #f1f3f6;
    --bs-app-bg-color: #f1f3f6;
    --bs-app-content-bg-color: #f1f3f6;
}

body#kt_app_body {
    background-color: #f1f3f6 !important;
}

body#kt_app_body .app-wrapper,
body#kt_app_body .app-main,
body#kt_app_body .d-flex.flex-column.flex-column-fluid,
body#kt_app_body .app-toolbar,
body#kt_app_body #kt_app_toolbar {
    background-color: #f1f3f6 !important;
}

html[data-bs-theme="light"] .app-content,
html[data-bs-theme="light"] #kt_app_content,
[data-bs-theme="light"] .app-content.flex-column-fluid {
    background-color: #f1f3f6 !important;
}

body#kt_app_body .card {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    border-radius: 0.75rem !important;
}

body#kt_app_body .card:not([style*="background-color"]) {
    background-color: #ffffff !important;
}

/* Sidebar */
[data-kt-app-sidebar-enabled="true"] .app-sidebar {
    background-color: var(--rp-primary) !important;
}

.app-sidebar .menu-title {
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 500;
}

.app-sidebar .menu-icon i {
    color: rgba(255, 255, 255, 0.6) !important;
}

.app-sidebar .menu-link:hover .menu-title,
.app-sidebar .menu-link.active .menu-title {
    color: #ffffff !important;
}

.app-sidebar .menu-link:hover .menu-icon i,
.app-sidebar .menu-link.active .menu-icon i {
    color: var(--rp-accent) !important;
}

.app-sidebar .menu-link:hover,
.app-sidebar .menu-link.active {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

.app-sidebar .menu-heading {
    color: rgba(255, 255, 255, 0.4) !important;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
}

.app-sidebar .menu-bullet .bullet {
    background-color: rgba(255, 255, 255, 0.4) !important;
}

.app-sidebar .menu-link:hover .menu-bullet .bullet,
.app-sidebar .menu-link.active .menu-bullet .bullet {
    background-color: var(--rp-accent) !important;
}

.app-sidebar .menu-arrow::after {
    color: rgba(255, 255, 255, 0.5) !important;
}

.sidebar-brand-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.app-sidebar-separator {
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.app-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--rp-gray-200);
}

.app-header-logo a {
    text-decoration: none;
}

/* Buttons */
.btn-rp-primary {
    background-color: var(--rp-primary) !important;
    border-color: var(--rp-primary) !important;
    color: #fff !important;
}

.btn-rp-primary:hover {
    background-color: var(--rp-primary-light) !important;
    border-color: var(--rp-primary-light) !important;
}

.btn-rp-accent {
    background-color: var(--rp-accent) !important;
    border-color: var(--rp-accent) !important;
    color: #fff !important;
}

.btn-rp-accent:hover {
    background-color: var(--rp-accent-light) !important;
}

/* Cards */
.card {
    border: 0;
    background-color: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.card-header {
    border-bottom: 1px solid var(--rp-gray-200);
}

/* Stats Card */
.stats-card {
    border-radius: 0.75rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08) !important;
}

.stats-card .stats-icon {
    width: 50px;
    height: 50px;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stats-card .stats-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--rp-primary);
}

.stats-card .stats-label {
    font-size: 0.85rem;
    color: var(--rp-gray-500);
    font-weight: 500;
}

.stats-card .stats-trend {
    font-size: 0.75rem;
    font-weight: 600;
}

.stats-card .stats-trend.up {
    color: var(--rp-green);
}

.stats-card .stats-trend.down {
    color: var(--rp-red);
}

/* Status badges */
.badge-draft { background-color: #e4e6ef; color: #7e8299; }
.badge-pending { background-color: #fff8dd; color: #f6c000; }
.badge-approved { background-color: #e8fff3; color: #17c653; }
.badge-rejected { background-color: #fff5f8; color: #f1416c; }
.badge-ordered { background-color: #f1faff; color: #009ef7; }
.badge-cancelled { background-color: #f5f5f5; color: #a1a5b7; }

.badge-priority-low { background-color: #e8fff3; color: #17c653; }
.badge-priority-medium { background-color: #fff8dd; color: #f6c000; }
.badge-priority-high { background-color: #fff5e6; color: #fd7e14; }
.badge-priority-critical { background-color: #fff5f8; color: #f1416c; }

/* Turkey Map */
.turkey-map-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.turkey-map-container svg {
    width: 100%;
    height: auto;
}

.turkey-city {
    fill: #e4e6ef;
    stroke: #ffffff;
    stroke-width: 0.5;
    cursor: pointer;
    transition: fill 0.2s, opacity 0.2s;
}

.turkey-city:hover {
    opacity: 0.8;
    stroke: var(--rp-primary);
    stroke-width: 1.5;
}

.turkey-city.level-1 { fill: #cce5ff; }
.turkey-city.level-2 { fill: #80bdff; }
.turkey-city.level-3 { fill: #4da3ff; }
.turkey-city.level-4 { fill: #2575fc; }
.turkey-city.level-5 { fill: var(--rp-primary); }

.map-tooltip {
    position: absolute;
    background: var(--rp-primary);
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.map-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--rp-primary) transparent transparent transparent;
}

.map-legend {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
    font-size: 0.75rem;
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.map-legend-color {
    width: 16px;
    height: 12px;
    border-radius: 2px;
}

/* Auth page */
.auth-bg {
    background: linear-gradient(135deg, var(--rp-primary) 0%, #0a3a8f 50%, #2575fc 100%);
    min-height: 100vh;
}

.auth-card {
    background: var(--rp-white);
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    max-width: 1000px;
    width: 100%;
}

.auth-form-side {
    padding: 3rem;
}

.auth-brand-side {
    background: var(--rp-primary);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
}

.auth-brand-side .brand-title {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.auth-brand-side .brand-subtitle {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: 0.5rem;
}

.auth-logo-text {
    font-size: 3rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 3px;
}

.auth-logo-accent {
    color: #2575fc;
}

.header-logo-text {
    font-size: 1.3rem;
    font-weight: 800;
    color: #012269;
    letter-spacing: 2px;
}

/* Notification badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--rp-red);
    color: #fff;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Tables */
.table thead th {
    font-weight: 600;
    color: var(--rp-gray-500);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--rp-gray-200);
}

/* Action buttons in tables */
.btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-action:hover {
    background-color: var(--rp-gray-100);
}

/* Offer form */
.offer-item-row {
    background: var(--rp-gray-100);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.offer-item-row .remove-item {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

.price-warning {
    border: 2px solid var(--rp-yellow) !important;
    animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: var(--rp-yellow); }
    50% { border-color: transparent; }
}

/* Notes/Chat */
.note-item {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.note-item.system {
    background: #f8f9fa;
    font-style: italic;
    color: var(--rp-gray-500);
}

.note-item.admin {
    background: #f1faff;
    border-left: 3px solid var(--rp-accent);
}

.note-item.dealer {
    background: #fff8dd;
    border-left: 3px solid var(--rp-yellow);
}

/* Offer PDF */
.offer-pdf-header {
    border-bottom: 3px solid var(--rp-primary);
    padding-bottom: 1rem;
}

.offer-pdf-footer {
    border-top: 2px solid var(--rp-primary);
    padding-top: 1rem;
    font-size: 0.8rem;
    color: var(--rp-gray-500);
}

/* Responsive */
@media (max-width: 768px) {
    .stats-card .stats-value {
        font-size: 1.3rem;
    }

    .auth-brand-side {
        display: none;
    }

    .auth-card {
        max-width: 100%;
        border-radius: 0;
    }

    .auth-form-side {
        padding: 2rem;
    }
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Quick actions */
.quick-action-card {
    border: 2px dashed var(--rp-gray-200);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.quick-action-card:hover {
    border-color: var(--rp-accent);
    background: #f1faff;
}

.quick-action-card i {
    font-size: 2rem;
    color: var(--rp-accent);
    margin-bottom: 0.5rem;
}

/* Timeline */
.timeline-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 1rem;
    border-left: 2px solid var(--rp-gray-200);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--rp-accent);
}

.timeline-item:last-child {
    border-left: 0;
}

/* Print styles */
@media print {
    .app-sidebar,
    .app-header,
    .no-print {
        display: none !important;
    }

    .app-content {
        margin: 0 !important;
        padding: 0 !important;
    }
}
