/* =========================================
   CRYPTO TEK AI - MINI APP MAIN STYLES
   ========================================= */

/* CSS Variables - Dark Theme by Default */
:root {
    /* Primary Colors */
    --tg-theme-bg-color: #0a0e1a;
    --tg-theme-text-color: #ffffff;
    --tg-theme-hint-color: #8a8a9a;
    --tg-theme-link-color: #2481cc;
    --tg-theme-button-color: #2481cc;
    --tg-theme-button-text-color: #ffffff;
    --tg-theme-secondary-bg-color: #1a1f35;

    /* App Colors */
    --primary-color: #FF6B35;
    --secondary-color: #2481cc;
    --success-color: #4CAF50;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --info-color: #2196F3;

    /* Dark Neutral Colors */
    --bg-primary: #0a0e1a;
    --bg-secondary: #1a1f35;
    --bg-tertiary: #252b45;
    --card-bg: #1a1f35;
    --card-bg-dark: #0a0e1a;
    --text-primary: #ffffff;
    --text-secondary: #b0b5c8;
    --text-muted: #8a8a9a;
    --border-color: #2a2f45;

    /* Dark Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.6);

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    --transition-slow: 400ms ease-in-out;

    /* Z-Index Layers */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* Light Theme (Optional - if user prefers) */
body.light-theme {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --card-bg: #ffffff;
    --card-bg-dark: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border-color: #dee2e6;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
}

/* =========================================
   GLOBAL RESET & BASE STYLES
   ========================================= */

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

/* Chrome smooth scrolling optimization */
body * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Chrome touch optimization */
a, button, input, select, textarea {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Chrome input styling fix */
input, select, textarea {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(180deg, #0a0e1a 0%, #1a1f35 100%);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: background var(--transition-normal), color var(--transition-normal);
    min-height: 100%;
    min-height: 100dvh; /* Dynamic viewport height - fixes mobile browser chrome issues */
    min-height: -webkit-fill-available;
    position: relative;
    touch-action: pan-y pan-x;
}

/* Light theme body override */
body.light-theme {
    background: linear-gradient(180deg, #ffffff 0%, #f5f7fa 100%);
}

/* =========================================
   LOADING SCREEN
   ========================================= */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-screen.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

.loading-content {
    text-align: center;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Logo image for loading screen - same as onboarding */
.loading-logo-img {
    width: 200px;
    height: 200px;
    margin-bottom: var(--spacing-lg);
    -webkit-animation: pulse 2s infinite;
    animation: pulse 2s infinite;
    object-fit: contain;
    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    display: block;
    background: white;
    padding: 15px;
}

.loading-title {
    color: white;
    font-size: 36px;
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Logo animation removed for performance */
.logo-animation {
    font-size: 64px;
    margin-bottom: var(--spacing-lg);
}

/* Loading spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    margin: var(--spacing-lg) auto 0;
    animation: spin 1s linear infinite;
}

/* Spin animation for loading spinners */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =========================================
   UTILITY CLASSES
   ========================================= */

.hidden {
    display: none !important;
}

.invisible {
    opacity: 0;
    pointer-events: none;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

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

.fw-bold {
    font-weight: 700;
}

.fw-normal {
    font-weight: 400;
}

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

.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-info {
    color: var(--info-color);
}

/* =========================================
   APP CONTAINER
   ========================================= */

.app-container {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height - better mobile support */
    min-height: -webkit-fill-available;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
    padding-bottom: 70px; /* Bottom nav space */
    overflow: hidden; /* Prevent overflow issues */
}

.app-container.hidden {
    display: none;
}

/* =========================================
   TOP BAR
   ========================================= */

.top-bar {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 56px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--spacing-md);
    z-index: var(--z-sticky);
    box-shadow: var(--shadow-sm);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.top-bar i {
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.top-bar i:hover {
    color: var(--text-primary);
}

.app-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* =========================================
   SIDE MENU
   ========================================= */

.side-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-modal);
    transition: left var(--transition-normal);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.side-menu:not(.hidden) {
    left: 0;
}

.side-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg) var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.side-menu-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.side-menu-header i {
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.side-menu-content {
    padding: var(--spacing-md);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--transition-fast);
    margin-bottom: var(--spacing-xs);
}

.menu-item:hover {
    background-color: var(--bg-secondary);
}

.menu-item i {
    font-size: 20px;
    color: var(--text-secondary);
    width: 24px;
}

.menu-item span {
    font-size: 16px;
    color: var(--text-primary);
}

/* =========================================
   PAGE CONTENT
   ========================================= */

.page-content {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    padding: var(--spacing-md);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-secondary);
    position: relative;
}

/* =========================================
   BOTTOM NAVIGATION
   ========================================= */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: rgba(10, 14, 26, 0.98);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: var(--z-fixed);
    box-shadow: 0 -2px 20px rgba(0,0,0,0.5);
    padding: 0 var(--spacing-sm);
    padding-bottom: env(safe-area-inset-bottom, 0);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

.nav-item {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    gap: 4px;
    padding: var(--spacing-sm);
    cursor: pointer;
    -webkit-transition: all var(--transition-fast);
    transition: all var(--transition-fast);
    border-radius: var(--radius-sm);
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    max-width: 80px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

.nav-item i {
    font-size: 22px;
    color: var(--text-secondary);
    -webkit-transition: color var(--transition-fast), -webkit-transform var(--transition-fast);
    transition: color var(--transition-fast), -webkit-transform var(--transition-fast);
    transition: color var(--transition-fast), transform var(--transition-fast);
    transition: color var(--transition-fast), transform var(--transition-fast), -webkit-transform var(--transition-fast);
}

.nav-item span {
    font-size: 11px;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
    font-weight: 500;
}

.nav-item.active i {
    color: var(--primary-color);
    -webkit-transform: scale(1.1);
    transform: scale(1.1);
}

.nav-item.active span {
    color: var(--primary-color);
    font-weight: 700;
}

.nav-item:hover:not(.active) {
    background-color: var(--bg-secondary);
}

/* Navigation Badge (Red Dot with Count) */
.nav-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    background: linear-gradient(135deg, #ff4444, #ff6b6b);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.4);
    z-index: 10;
}

/* =========================================
   DEVELOPMENT BADGE (Feature Flags)
   Sadece localhost'ta görünür
   ========================================= */
.dev-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: linear-gradient(135deg, #9c27b0, #673ab7);
    color: white;
    font-size: 7px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(156, 39, 176, 0.4);
    z-index: 15;
    animation: dev-pulse 2s ease-in-out infinite;
}

@keyframes dev-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Side menu dev badge */
.menu-item .dev-badge {
    position: relative;
    top: auto;
    right: auto;
    margin-left: 8px;
}

/* 💎 Upgrade Menu Item - Özel stil */
.menu-item-upgrade {
    margin-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
    padding-top: var(--spacing-md) !important;
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.1) 0%, rgba(52, 152, 219, 0.1) 100%);
}

.menu-item-upgrade:hover {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.2) 0%, rgba(52, 152, 219, 0.2) 100%) !important;
}

.menu-item-upgrade i {
    color: #f39c12 !important;
}

.menu-item-upgrade span {
    font-weight: 600;
    background: linear-gradient(135deg, #9b59b6, #3498db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* =========================================
   TOAST NOTIFICATIONS
   ========================================= */

.toast-container {
    position: fixed;
    top: 70px;
    right: var(--spacing-md);
    z-index: var(--z-tooltip);
    pointer-events: none;
}

.toast {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    min-width: 280px;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    gap: var(--spacing-md);
    pointer-events: all;
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

.toast.info {
    border-left: 4px solid var(--info-color);
}

.toast-icon {
    font-size: 20px;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--danger-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

.toast.info .toast-icon {
    color: var(--info-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 14px;
    color: var(--text-secondary);
}

/* =========================================
   CARDS
   ========================================= */

.card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    transition: box-shadow var(--transition-fast);
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    color: var(--text-secondary);
}

/* =========================================
   BUTTONS
   ========================================= */

.btn {
    display: -webkit-inline-box;
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    -webkit-transition: all var(--transition-fast);
    transition: all var(--transition-fast);
    text-decoration: none;
    outline: none;
    white-space: nowrap;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    -webkit-transform: scale(0.98);
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #e55a2b;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #1f6fb8;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================================
   FORMS
   ========================================= */

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* =========================================
   TOGGLE SWITCH
   ========================================= */

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--primary-color);
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .top-bar {
        height: 50px;
        padding: 0 var(--spacing-sm);
    }

    .app-title {
        font-size: 16px;
    }

    .bottom-nav {
        height: 65px;
    }

    .nav-item span {
        font-size: 10px;
    }
}

/* =========================================
   MODAL STYLES
   ========================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 10;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-header .close-btn {
    background: rgba(244, 67, 54, 0.1);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: #f44336;
    transition: all 0.2s;
}

.modal-header .close-btn:hover {
    background: rgba(244, 67, 54, 0.2);
    transform: scale(1.1);
}

.modal-body {
    padding: 20px;
}

/* Dark theme modal adjustments */
body.dark-theme .modal-overlay {
    background: rgba(0, 0, 0, 0.9);
}

body.dark-theme .modal-content {
    background: #1a1a1a;
    border: 1px solid rgba(255, 107, 53, 0.2);
}

/* =========================================
   DARK FUNNEL FULL WIDTH MODAL (Telegram Mobile)
   ========================================= */
.modal-overlay.dark-funnel-modal {
    align-items: flex-start;
    -webkit-box-align: start;
    -webkit-align-items: flex-start;
    padding: 0;
}

.modal-overlay.dark-funnel-modal .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    display: flex;
    flex-direction: column;
}

.modal-overlay.dark-funnel-modal .modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 107, 53, 0.3);
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.15), rgba(255, 107, 53, 0.05));
    flex-shrink: 0;
}

.modal-overlay.dark-funnel-modal .modal-body {
    padding: 16px;
    padding-bottom: 100px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.modal-overlay.dark-funnel-modal .modal-body > div {
    flex: 1;
    padding-bottom: 60px;
}

/* =========================================
   CHROME & TELEGRAM PERFORMANCE OPTIMIZATIONS
   ========================================= */

/* Hardware acceleration for smooth animations */
.loading-screen,
.modal-overlay,
.bottom-nav,
.top-bar,
.side-menu {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

/* Scroll-specific optimizations for Chrome/Telegram */
.page-content {
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    overflow-x: hidden;
    touch-action: pan-y;
}

/* Smooth scrolling for Chrome */
@media screen and (-webkit-min-device-pixel-ratio:0) {
    body {
        -webkit-font-smoothing: subpixel-antialiased;
    }
}

/* Chrome mobile safe area support */
@supports (padding: env(safe-area-inset-bottom)) {
    .bottom-nav {
        padding-bottom: calc(env(safe-area-inset-bottom) + 8px);
        height: calc(70px + env(safe-area-inset-bottom));
    }

    .app-container {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }
}

/* =========================================
   NOTIFICATION BADGE FIX (TOP BAR)
   ========================================= */

/* Notification badge in top bar */
#notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: linear-gradient(135deg, #ff4444, #ff6b6b);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    height: 16px;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.4);
    z-index: 10;
}

/* Ensure notification icon wrapper is relative positioned */
.notification-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* =========================================
   MANUAL ANALYSIS WATCHLIST MODAL
   ========================================= */

.manual-watchlist-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.manual-watchlist-modal {
    background: linear-gradient(145deg, #1a1f35 0%, #0f1320 100%);
    border-radius: 20px;
    width: 100%;
    max-width: 380px;
    border: 1px solid rgba(255, 107, 53, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

.manual-watchlist-modal .watchlist-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.manual-watchlist-modal .watchlist-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.manual-watchlist-modal .modal-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.manual-watchlist-modal .modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.manual-watchlist-modal .watchlist-modal-body {
    padding: 20px;
}

.manual-watchlist-modal .watchlist-modal-desc {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.manual-watchlist-modal .watchlist-category-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.manual-watchlist-modal .watchlist-category-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 107, 53, 0.3);
}

.manual-watchlist-modal .watchlist-category-item.selected {
    background: rgba(255, 107, 53, 0.15);
    border-color: rgba(255, 107, 53, 0.5);
}

.manual-watchlist-modal .category-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    margin-right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.manual-watchlist-modal .watchlist-category-item.selected .category-checkbox {
    background: linear-gradient(135deg, #FF6B35, #ff8c5a);
    border-color: #FF6B35;
}

.manual-watchlist-modal .category-checkbox::after {
    content: '✓';
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.manual-watchlist-modal .watchlist-category-item.selected .category-checkbox::after {
    opacity: 1;
}

.manual-watchlist-modal .category-info {
    flex: 1;
}

.manual-watchlist-modal .category-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}

.manual-watchlist-modal .category-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.manual-watchlist-modal .watchlist-add-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #FF6B35, #ff8c5a);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.manual-watchlist-modal .watchlist-add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.4);
}

.manual-watchlist-modal .watchlist-add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* =========================================
   FULLSCREEN SUPPORT (Chrome Fix)
   ========================================= */

/* Fullscreen pseudo-class support */
:fullscreen {
    width: 100% !important;
    height: 100% !important;
    background: var(--bg-primary);
}

:-webkit-full-screen {
    width: 100% !important;
    height: 100% !important;
    background: var(--bg-primary);
}

/* Body fullscreen state class */
body.is-fullscreen {
    width: 100% !important;
    height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

body.is-fullscreen .app-container {
    min-height: var(--viewport-height, 100vh) !important;
    height: auto !important;
}

body.is-fullscreen .page-content {
    min-height: calc(var(--viewport-height, 100vh) - 150px) !important;
}

/* Fixed elements in fullscreen */
body.is-fullscreen .top-bar,
body.is-fullscreen .bottom-nav {
    position: fixed !important;
    width: 100% !important;
}

body.is-fullscreen .loading-screen {
    width: 100% !important;
    height: var(--viewport-height, 100vh) !important;
}

/* Modal overlays in fullscreen */
body.is-fullscreen .modal-overlay,
body.is-fullscreen .opportunity-detail-modal,
body.is-fullscreen .tv-watchlist-popup,
body.is-fullscreen .diamond-detail-modal-overlay {
    width: 100% !important;
    height: var(--viewport-height, 100vh) !important;
}
