:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --surface-color: rgba(255, 255, 255, 0.85);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: rgba(226, 232, 240, 0.8);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 16px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    --glass-blur: blur(12px);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    /* Subtle mesh gradient background for premium feel */
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,0) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,0.03) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,0.03) 0, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--surface-color);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Screens (SPA Logic) */
.screen {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* Typography & Utilities */
h1, h2, h3, h4 {
    font-weight: 600;
    color: var(--text-main);
}
.text-primary { color: var(--primary-color); }
.text-gray { color: var(--text-muted); }
.bg-blue { background-color: rgba(37, 99, 235, 0.1); color: #2563eb; }
.bg-green { background-color: rgba(16, 185, 129, 0.1); color: #10b981; }
.bg-orange { background-color: rgba(245, 158, 11, 0.1); color: #f59e0b; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: rgba(0,0,0,0.02);
    border-color: var(--text-muted);
}

.btn-block {
    width: 100%;
}

/* --- OTP Login Screen --- */
#login-screen {
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    padding: 40px;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
}

.logo h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-title {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 30px;
    line-height: 1.5;
}

.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 30px;
}

.otp-input {
    width: 48px;
    height: 56px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.5);
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-main);
    transition: all 0.2s;
}

.otp-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: white;
}

.resend-text {
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.resend-text a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

/* --- Main App Layout --- */
#app-screen {
    height: 100vh;
    display: flex;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    height: calc(100vh - 32px);
    margin: 16px;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.2rem;
    border-bottom: 1px solid var(--border-color);
}

.nav-links {
    list-style: none;
    padding: 24px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item i {
    width: 20px;
    height: 20px;
}

.nav-item:hover {
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-main);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.sidebar-footer {
    padding: 24px 16px;
    border-top: 1px solid var(--border-color);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

.topbar {
    padding: 24px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(248, 250, 252, 0.8);
    backdrop-filter: blur(12px);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.icon-btn {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    color: var(--text-muted);
    transition: all 0.2s;
}

.icon-btn:hover {
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-name {
    font-weight: 500;
    font-size: 0.95rem;
}

.content-wrapper {
    padding: 0 40px 40px;
}

/* Views Setup */
.view {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.animate-spin {
    animation: spin 1s linear infinite;
}

/* --- Dashboard Components --- */
.welcome-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,255,255,0.6));
}

.banner-text h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.banner-text p {
    color: var(--text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s ease;
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon i {
    width: 24px;
    height: 24px;
}

.stat-info span {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.stat-info h4 {
    font-size: 1.5rem;
    margin: 0;
}

.section-title {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.recent-quotes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.quote-card {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s ease;
}

.quote-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

.company-logo {
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.quote-details h4 {
    margin-bottom: 4px;
}

.quote-details span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.quote-price {
    text-align: right;
}

.quote-price h4 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 8px;
}

/* --- Quotes List --- */
.filters {
    display: flex;
    gap: 12px;
    padding: 12px;
    margin-bottom: 24px;
    display: inline-flex;
}

.filter-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: rgba(0,0,0,0.03);
}

.filter-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.quotes-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.quote-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    transition: transform 0.2s ease;
}

.quote-list-item:hover {
    transform: translateX(4px);
}

.item-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.company-badge {
    width: 80px;
    height: 80px;
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.2;
    padding: 10px;
}

.item-info h4 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.item-info p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.tag {
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-main);
}

.item-right {
    display: flex;
    align-items: center;
    gap: 30px;
}

.price-info {
    text-align: right;
}

.old-price {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: block;
    margin-bottom: 4px;
}

.price-info h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

/* --- Policies --- */
.policies-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

.policy-card {
    padding: 24px;
}

.policy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border-color);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
    background: #f1f5f9;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.policy-no {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.policy-body {
    margin-bottom: 24px;
}

.policy-type h3 {
    margin-bottom: 4px;
}

.policy-type span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.policy-dates {
    display: flex;
    gap: 40px;
    margin-top: 20px;
    background: rgba(0,0,0,0.02);
    padding: 16px;
    border-radius: 8px;
}

.date-col span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.policy-footer {
    display: flex;
    gap: 12px;
}

.policy-footer .btn {
    flex: 1;
}

/* --- Profile --- */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.profile-card {
    padding: 30px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-mernis {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    transition: all 0.2s;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input:disabled {
    background: rgba(0,0,0,0.02);
    color: var(--text-muted);
    cursor: not-allowed;
}

.mernis-locked {
    position: relative;
    overflow: hidden;
}

.mernis-locked::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 4px; height: 100%;
    background: var(--success);
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Responsive */
/* Responsive Mobile App-Like Design */
@media (max-width: 768px) {
    body {
        /* Prevent body scroll bounce on iOS */
        overscroll-behavior-y: none;
    }
    
    #app-screen {
        flex-direction: column;
        height: 100vh;
        height: 100dvh; /* use dynamic viewport height for mobile browsers */
    }

    /* Transform Sidebar into Bottom Navigation */
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 70px;
        margin: 0;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
        border-left: none;
        border-right: none;
        border-top: 1px solid var(--border-color);
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 100;
        display: flex;
        flex-direction: row;
        justify-content: center;
        padding: 0;
    }

    .sidebar-header, .sidebar-footer {
        display: none; /* Hide logo and footer in bottom nav */
    }

    .nav-links {
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        padding: 0;
        width: 100%;
        height: 100%;
    }

    .nav-item {
        flex-direction: column;
        gap: 4px;
        padding: 8px;
        font-size: 0.7rem;
        flex: 1;
        text-align: center;
        border-radius: 0;
    }

    .nav-item i {
        width: 22px;
        height: 22px;
        margin: 0 auto;
    }

    .nav-item.active {
        background: transparent;
        color: var(--primary-color);
        box-shadow: none;
        font-weight: 700;
    }
    
    .nav-item.active i {
        color: var(--primary-color);
    }

    .main-content {
        padding-bottom: 70px; /* Space for bottom nav */
        height: 100%;
    }

    .topbar {
        padding: 16px 20px;
        background: rgba(248, 250, 252, 0.95);
    }
    
    .welcome-banner {
        padding: 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        text-align: left;
    }

    .content-wrapper {
        padding: 0 15px 20px;
    }

    /* Cards & Lists */
    .quote-list-item {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        gap: 16px;
    }

    .item-left {
        gap: 15px;
    }
    
    .company-badge {
        width: 60px;
        height: 60px;
    }
    
    .item-info h4 {
        font-size: 1rem;
        margin-bottom: 4px;
    }

    .item-right {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        border-top: 1px solid rgba(0,0,0,0.05);
        padding-top: 12px;
    }

    .price-info h2 {
        font-size: 1.3rem;
    }

    /* Profile Grid fix for small screens */
    .profile-grid {
        grid-template-columns: 1fr;
    }
    
    .policy-dates {
        flex-direction: column;
        gap: 15px;
    }
    
    .sirket-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .sirket-fiyat {
        text-align: left;
    }
    .sirket-fiyat small {
        text-align: left;
    }
    
    .login-card {
        padding: 20px;
    }
    
    .otp-inputs {
        gap: 5px;
    }
    .otp-input {
        width: 40px;
        height: 50px;
        font-size: 1.2rem;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal.active {
    display: flex;
}
.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
    position: relative;
    backdrop-filter: blur(10px);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
    margin-bottom: 15px;
}
.modal-header h3 { margin: 0; font-size: 1.2rem; }
.close-modal {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
}
.sirket-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sirket-row:last-child {
    border-bottom: none;
}
.sirket-logo img {
    max-height: 40px;
    max-width: 120px;
    object-fit: contain;
    background: white;
    padding: 5px;
    border-radius: 6px;
}
.sirket-fiyat {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    text-align: right;
}
.sirket-fiyat small {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    text-align: right;
}

