/* ============================================
   ПОХОДЕН ТЕЛЕФОН - Phone Styles
   Retro Nokia + Legendary Item
   ============================================ */

/* Legendary Phone Glow Animation */
@keyframes legendaryGlow {
    0%, 100% {
        box-shadow: inset 0 0 20px rgba(212, 175, 55, 0.3);
    }
    50% {
        box-shadow: inset 0 0 40px rgba(212, 175, 55, 0.6);
    }
}

.legendary-glow-animation {
    animation: legendaryGlow 3s ease-in-out infinite;
}

/* Global overflow fix for phone modal */
.phone-modal-overlay *,
.phone-modal-overlay *::before,
.phone-modal-overlay *::after {
    box-sizing: border-box;
}

/* Prevent horizontal overflow */
@media (max-width: 768px) {
    body:has(.phone-modal-overlay) {
        overflow: hidden;
    }
}

/* Phone Modal Overlay */
.phone-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Mobile: Remove padding */
@media (max-width: 768px) {
    .phone-modal-overlay {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }
}

.phone-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

/* Mobile: Hide backdrop (full-screen mode) */
@media (max-width: 768px) {
    .phone-modal-backdrop {
        display: none;
    }
}

/* Phone Device (Smartphone Frame) */
.phone-device {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: linear-gradient(145deg, #2d2d2d, #1a1a1a);
    border-radius: 32px;
    padding: 20px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.9),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
    border: 4px solid #1a1a1a;
    z-index: 10001;
    animation: phoneSlideUp 0.3s ease-out;
    margin: 0 auto;
}

/* Mobile: Full screen mode */
@media (max-width: 768px) {
    .phone-device {
        position: fixed;
        inset: 0;
        max-width: 100%;
        border-radius: 0;
        padding: 0;
        border: none;
        margin: 0;
    }
}

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

/* Phone Notch */
.phone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 24px;
    background: #1a1a1a;
    border-radius: 0 0 16px 16px;
    z-index: 10;
}

/* Mobile: Hide notch */
@media (max-width: 768px) {
    .phone-notch {
        display: none;
    }
}

/* Phone Screen (Retro Nokia LCD Style) */
.phone-screen {
    background: linear-gradient(145deg, #1a3a1a, #0d2a0d);
    border-radius: 20px;
    padding: 24px 20px;
    min-height: 650px;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow:
        inset 0 4px 8px rgba(0, 0, 0, 0.6),
        inset 0 0 40px rgba(0, 255, 0, 0.05);
    border: 3px solid #2a4a2a;
    font-family: 'Courier New', monospace;
}

/* Mobile: Full screen with safe areas - NO SCROLL on screen, only on content */
@media (max-width: 768px) {
    .phone-screen {
        border-radius: 0;
        border: none;
        min-height: 100vh;
        min-height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        height: 100vh;
        height: 100dvh;
        padding: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden; /* NO scroll on screen */
    }
}

/* Phone Screen Scrollbar */
.phone-screen::-webkit-scrollbar {
    width: 8px;
}

.phone-screen::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.phone-screen::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 0, 0.3);
    border-radius: 4px;
}

.phone-screen::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 0, 0.5);
}

/* Phone Header */
.phone-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(0, 255, 0, 0.3);
    flex-shrink: 0;
}

/* Mobile: Add padding and safe area */
@media (max-width: 768px) {
    .phone-header {
        padding: 12px 16px;
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
        margin-bottom: 0;
        background: linear-gradient(145deg, #1a3a1a, #0d2a0d);
    }
}

/* Back button (oldschool Nokia style) */
.phone-back-btn {
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid rgba(0, 255, 0, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Courier New', monospace;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.phone-back-btn:hover {
    background: rgba(0, 255, 0, 0.2);
    border-color: rgba(0, 255, 0, 0.6);
    transform: translateX(-2px);
}

.phone-back-btn:active {
    transform: scale(0.95);
}

.back-arrow {
    font-size: 1.2rem;
    color: #00ff00;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.6);
}

.back-text {
    font-size: 0.75rem;
    color: #00ff00;
    font-weight: bold;
    letter-spacing: 1px;
    text-shadow: 0 0 4px rgba(0, 255, 0, 0.4);
}

/* Close button */
.phone-close-btn {
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid rgba(0, 255, 0, 0.3);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: none; /* Hidden on desktop (backdrop click works) */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.phone-close-btn:hover {
    background: rgba(0, 255, 0, 0.2);
    border-color: rgba(0, 255, 0, 0.6);
    transform: scale(1.1);
}

.phone-close-btn:active {
    transform: scale(0.95);
}

/* Mobile: Add close button and sticky header */
@media (max-width: 768px) {
    .phone-header {
        grid-template-columns: auto 1fr auto auto;
        position: sticky;
        top: 0;
        z-index: 100;
        background: linear-gradient(145deg, #1a3a1a, #0d2a0d);
        padding: env(safe-area-inset-top, 16px) 16px 16px 16px;
        margin: 0;
        border-bottom: 2px solid rgba(0, 255, 0, 0.5);
        gap: 8px;
        flex-shrink: 0;
    }

    .phone-title {
        font-size: 1.1rem;
    }

    .phone-back-btn {
        padding: 6px 8px;
        gap: 4px;
    }

    .back-arrow {
        font-size: 1.1rem;
    }

    .back-text {
        display: none; /* Hide "BACK" text on mobile, only show arrow */
    }

    .phone-status {
        flex-direction: row;
        gap: 8px;
    }

    .battery-indicator {
        font-size: 0.95rem;
    }

    /* Hide signal indicator on mobile to save space */
    .signal-indicator {
        display: none;
    }

    .phone-close-btn {
        display: flex; /* Show on mobile */
        width: 40px;
        height: 40px;
        border-width: 2px;
        flex-shrink: 0;
    }

    .phone-close-btn span {
        font-size: 1.4rem !important;
    }
}

.phone-title {
    color: #00ff00;
    font-size: 1.3rem;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.6);
}

.phone-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.battery-indicator,
.signal-indicator {
    color: #00ff00;
    font-size: 0.9rem;
    text-shadow: 0 0 4px rgba(0, 255, 0, 0.4);
}

/* Phone Navigation Tabs */
.phone-navigation {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(0, 255, 0, 0.2);
    flex-shrink: 0;
}

/* Mobile: Bottom navigation */
@media (max-width: 768px) {
    .phone-navigation {
        /* Remove sticky - use flex layout instead for proper scrolling */
        z-index: 100;
        background: linear-gradient(145deg, #1a3a1a, #0d2a0d);
        margin: 0;
        padding: 6px 4px;
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
        border-bottom: none;
        border-top: 2px solid rgba(0, 255, 0, 0.5);
        gap: 3px;
        flex-shrink: 0;
    }

    .phone-tab {
        padding: 6px 2px;
        border-width: 1px;
        border-radius: 4px;
        gap: 1px;
    }

    .tab-icon {
        font-size: 1rem;
        margin-bottom: 1px;
        letter-spacing: 0;
    }

    .tab-label {
        font-size: 0.5rem;
        margin-top: 1px;
        letter-spacing: 0;
    }

    .tab-badge {
        font-size: 0.45rem;
        margin-top: 0;
    }
}

.phone-tab {
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid rgba(0, 255, 0, 0.3);
    border-radius: 8px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.phone-tab:hover {
    background: rgba(0, 255, 0, 0.2);
    border-color: rgba(0, 255, 0, 0.6);
    transform: scale(1.05);
}

.phone-tab.active {
    background: rgba(0, 255, 0, 0.25);
    border-color: rgba(0, 255, 0, 0.8);
    box-shadow: 0 0 12px rgba(0, 255, 0, 0.4);
}

.tab-icon {
    font-size: 1.5rem;
    text-align: center;
    color: #00ff00;
    font-weight: bold;
    letter-spacing: 1px;
    line-height: 1.2;
    margin-bottom: 4px;
}

/* Tab Label (oldschool text) */
.tab-label {
    font-size: 0.6rem;
    color: #00ff00;
    text-align: center;
    font-weight: bold;
    letter-spacing: 0.5px;
    opacity: 0.9;
    text-shadow: 0 0 4px rgba(0, 255, 0, 0.3);
    margin-top: 2px;
}

/* Tab Badge (counters) */
.tab-badge {
    font-size: 0.55rem;
    color: #ffff00;
    text-align: center;
    font-weight: bold;
    margin-top: 2px;
    text-shadow: 0 0 6px rgba(255, 255, 0, 0.6);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Active tab - brighter */
.phone-tab.active .tab-icon,
.phone-tab.active .tab-label {
    color: #00ff00;
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.8);
}

/* Phone Content Area - SMOOTH TAB SWITCHING */
.phone-content {
    color: #00ff00;
    min-height: 400px;
    overflow-x: hidden;
    /* Smooth fade transition for tab switching */
    transition: opacity 0.15s ease-in-out;
    opacity: 1;
}

/* Desktop: Add padding */
@media (min-width: 769px) {
    .phone-content {
        padding: 0 4px;
    }
}

/* Mobile: Flexible content area - ONLY scrollable part */
@media (max-width: 768px) {
    .phone-content {
        flex: 1;
        min-height: 0; /* Reset min-height for proper flex behavior */
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 12px 16px 16px 16px;
        scroll-behavior: smooth;
        overscroll-behavior: contain; /* Prevent pull-to-refresh */

        /* Hide scrollbar on mobile */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }

    /* Hide scrollbar on mobile (WebKit) */
    .phone-content::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }
}

.phone-section-title {
    color: #00ff00;
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.6);
}

/* Quick Actions Grid */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

/* Mobile: Larger touch targets */
@media (max-width: 768px) {
    .quick-actions {
        gap: 16px;
    }
}

.quick-btn {
    background: linear-gradient(145deg, rgba(0, 255, 0, 0.15), rgba(0, 200, 0, 0.1));
    border: 3px solid rgba(0, 255, 0, 0.4);
    border-radius: 12px;
    padding: 20px 12px;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.8);
    touch-action: manipulation; /* Disable double-tap zoom */
    -webkit-tap-highlight-color: transparent;
}

/* Mobile: Ultra-compact buttons for no-scroll home */
@media (max-width: 768px) {
    .quick-actions {
        gap: 8px;
        margin-bottom: 12px;
    }

    .quick-btn {
        padding: 12px 8px;
        min-height: 60px;
        gap: 4px;
    }

    .quick-btn-icon {
        font-size: 1.6rem;
    }

    .quick-btn-label {
        font-size: 0.7rem;
        line-height: 1.1;
        font-weight: bold;
    }
}

.quick-btn:hover {
    background: linear-gradient(145deg, rgba(0, 255, 0, 0.25), rgba(0, 200, 0, 0.2));
    border-color: rgba(0, 255, 0, 0.8);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.4);
}

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

.quick-btn.sos {
    background: linear-gradient(145deg, rgba(255, 0, 0, 0.2), rgba(200, 0, 0, 0.15));
    border-color: rgba(255, 0, 0, 0.6);
    color: #ff0000;
    text-shadow: 0 0 6px rgba(255, 0, 0, 0.8);
    animation: sosGlow 2s ease-in-out infinite;
}

@keyframes sosGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 0, 0, 0.4); }
    50% { box-shadow: 0 0 25px rgba(255, 0, 0, 0.8); }
}

.quick-btn-icon {
    font-size: 2rem;
}

.quick-btn-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Message List */
.message-category {
    margin-bottom: 20px;
}

.category-label {
    color: #00ff00;
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 8px;
    opacity: 0.7;
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-btn {
    background: rgba(0, 255, 0, 0.05);
    border: 2px solid rgba(0, 255, 0, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Mobile: Compact message buttons */
@media (max-width: 768px) {
    .message-btn {
        padding: 12px 14px;
        font-size: 0.9rem;
        min-height: 48px;
        display: flex;
        align-items: center;
        line-height: 1.3;
    }

    .message-list {
        gap: 8px;
    }

    .message-category {
        margin-bottom: 14px;
    }

    .category-label {
        font-size: 0.8rem;
        margin-bottom: 8px;
    }

    .phone-section-title {
        font-size: 0.9rem;
        margin-bottom: 10px;
        margin-top: 12px;
        letter-spacing: 1px;
    }

    /* First section title - no top margin */
    .phone-section-title:first-child {
        margin-top: 0;
    }
}

.message-btn:hover {
    background: rgba(0, 255, 0, 0.15);
    border-color: rgba(0, 255, 0, 0.6);
    transform: translateX(4px);
}

/* Custom Message Area */
.custom-message-area {
    margin-top: 20px;
}

.custom-textarea {
    width: 100%;
    background: rgba(0, 255, 0, 0.05);
    border: 2px solid rgba(0, 255, 0, 0.4);
    border-radius: 8px;
    padding: 12px;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    min-height: 80px;
    resize: vertical;
}

/* Mobile: Compact textarea */
@media (max-width: 768px) {
    .custom-message-area {
        margin-top: 16px;
    }

    .custom-textarea {
        font-size: 0.95rem;
        padding: 12px;
        min-height: 90px;
        max-height: 40vh; /* Prevent excessive height */
        border-width: 2px;
        line-height: 1.4;
        box-sizing: border-box;
    }

    /* Ensure all input/textarea elements fit properly */
    .phone-content input,
    .phone-content textarea {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Prevent horizontal overflow in content */
    .phone-content * {
        max-width: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Ensure images don't cause overflow */
    .phone-content img {
        max-width: 100%;
        height: auto;
    }

    /* Touch-friendly buttons - minimum 44x44px target */
    .phone-content button,
    .phone-content .btn,
    .phone-content a[onclick] {
        min-height: 44px;
        padding: 12px 16px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
}

.custom-textarea::placeholder {
    color: rgba(0, 255, 0, 0.4);
}

.custom-textarea:focus {
    outline: none;
    border-color: rgba(0, 255, 0, 0.8);
    box-shadow: 0 0 12px rgba(0, 255, 0, 0.3);
}

.send-custom-btn {
    width: 100%;
    margin-top: 12px;
    background: linear-gradient(145deg, rgba(0, 255, 0, 0.2), rgba(0, 200, 0, 0.15));
    border: 3px solid rgba(0, 255, 0, 0.5);
    border-radius: 10px;
    padding: 14px;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.8);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Mobile: Compact send button */
@media (max-width: 768px) {
    .send-custom-btn {
        padding: 14px;
        font-size: 1rem;
        min-height: 52px;
        margin-top: 10px;
    }
}

.send-custom-btn:hover {
    background: linear-gradient(145deg, rgba(0, 255, 0, 0.3), rgba(0, 200, 0, 0.25));
    border-color: rgba(0, 255, 0, 0.8);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.4);
}

/* Charging Section */
.charging-section {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 255, 0, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
}

.battery-info {
    color: #00ff00;
    font-size: 0.95rem;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.charge-btn {
    width: 100%;
    background: linear-gradient(145deg, rgba(34, 197, 94, 0.2), rgba(22, 163, 74, 0.15));
    border: 3px solid rgba(34, 197, 94, 0.5);
    border-radius: 10px;
    padding: 14px;
    color: #22c55e;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 6px rgba(34, 197, 94, 0.8);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Mobile: Ultra-compact battery section */
@media (max-width: 768px) {
    .charging-section {
        padding: 10px;
        margin-top: 0;
        border-width: 2px;
    }

    .battery-info {
        font-size: 0.85rem;
        gap: 4px;
        margin-bottom: 8px;
        line-height: 1.4;
    }

    .charge-btn {
        padding: 12px;
        font-size: 0.9rem;
        min-height: 48px;
    }
}

.charge-btn:hover:not(:disabled) {
    background: linear-gradient(145deg, rgba(34, 197, 94, 0.3), rgba(22, 163, 74, 0.25));
    border-color: rgba(34, 197, 94, 0.8);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
}

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

/* Contact Card */
.contact-card {
    background: rgba(0, 255, 0, 0.05);
    border: 2px solid rgba(0, 255, 0, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

/* Mobile: Compact contact cards */
@media (max-width: 768px) {
    .contact-card {
        padding: 14px;
        margin-bottom: 10px;
        border-width: 2px;
    }
}

.contact-card:hover {
    background: rgba(0, 255, 0, 0.1);
    border-color: rgba(0, 255, 0, 0.5);
}

.contact-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.contact-avatar {
    font-size: 2rem;
}

/* Mobile: Compact contact elements */
@media (max-width: 768px) {
    .contact-header {
        gap: 10px;
        margin-bottom: 8px;
    }

    .contact-avatar {
        font-size: 2rem;
    }

    .contact-name {
        font-size: 1rem;
        line-height: 1.3;
    }

    .contact-info {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
}

.contact-name {
    color: #00ff00;
    font-size: 1.1rem;
    font-weight: bold;
}

.contact-info {
    color: rgba(0, 255, 0, 0.7);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.contact-actions {
    display: flex;
    gap: 8px;
}

.contact-btn {
    flex: 1;
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid rgba(0, 255, 0, 0.4);
    border-radius: 8px;
    padding: 10px;
    color: #00ff00;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Mobile: Compact contact action buttons */
@media (max-width: 768px) {
    .contact-actions {
        gap: 8px;
    }

    .contact-btn {
        padding: 10px;
        font-size: 0.85rem;
        min-height: 44px;
        border-width: 2px;
    }
}

.contact-btn:hover {
    background: rgba(0, 255, 0, 0.2);
    border-color: rgba(0, 255, 0, 0.6);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .phone-device {
        max-width: 100%;
        border-radius: 24px;
        padding: 16px;
    }

    .phone-screen {
        padding: 20px 16px;
        min-height: 600px;
    }

    .phone-title {
        font-size: 1.1rem;
    }

    .phone-navigation {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
    }

    .phone-tab {
        padding: 10px 6px;
    }

    .tab-icon {
        font-size: 1.3rem;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .quick-btn {
        padding: 16px 10px;
    }

    .quick-btn-icon {
        font-size: 1.8rem;
    }

    .quick-btn-label {
        font-size: 0.75rem;
    }
}

/* ============================================
   MESSAGE MODAL - Send Direct Message
   ============================================ */

/* Message Modal Overlay */
.phone-message-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10002; /* Above phone modal */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.phone-message-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

/* Message Modal Content */
.phone-message-modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    background: linear-gradient(145deg, #1a3a1a, #0d2a0d);
    border-radius: 16px;
    padding: 20px;
    border: 3px solid rgba(0, 255, 0, 0.5);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
    font-family: 'Courier New', monospace;
    z-index: 1;
}

/* Mobile: Full screen modal */
@media (max-width: 768px) {
    .phone-message-modal-overlay {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }

    .phone-message-modal-backdrop {
        display: none;
    }

    .phone-message-modal-content {
        max-width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        border: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Message Modal Header */
.phone-message-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(0, 255, 0, 0.3);
    gap: 12px;
}

.phone-message-modal-title {
    flex: 1;
    color: #00ff00;
    font-size: 1.1rem;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.6);
}

/* Mobile: Larger title */
@media (max-width: 768px) {
    .phone-message-modal-header {
        padding: env(safe-area-inset-top, 16px) 16px 16px 16px;
        margin: 0 -20px 20px -20px;
        background: linear-gradient(145deg, #1a3a1a, #0d2a0d);
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .phone-message-modal-title {
        font-size: 1.2rem;
    }
}

/* Quick Messages Section */
.phone-message-quick {
    margin-bottom: 20px;
}

.phone-message-quick .message-btn {
    width: 100%;
}

/* Scrollbar for message modal */
.phone-message-modal-content::-webkit-scrollbar {
    width: 8px;
}

.phone-message-modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.phone-message-modal-content::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 0, 0.3);
    border-radius: 4px;
}

.phone-message-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 0, 0.5);
}

/* ============================================
   MESSAGES TAB - Conversation List & Thread
   ============================================ */

/* Conversations List */
.phone-conversations-list {
    padding: 8px 0;
}

/* Conversation Card */
.conversation-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 255, 0, 0.05);
    border: 2px solid rgba(0, 255, 0, 0.2);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.conversation-card:hover {
    background: rgba(0, 255, 0, 0.1);
    border-color: rgba(0, 255, 0, 0.4);
}

.conversation-avatar {
    font-size: 2rem;
    flex-shrink: 0;
}

.conversation-details {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.conversation-name {
    font-weight: bold;
    color: #00ff00;
    font-size: 0.95rem;
}

.conversation-unread-badge {
    background: #ff5555;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    animation: badgePulse 2s ease-in-out infinite;
}

.conversation-preview {
    font-size: 0.85rem;
    color: rgba(0, 255, 0, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.conversation-time {
    font-size: 0.75rem;
    color: rgba(0, 255, 0, 0.5);
}

/* Conversation Thread Header */
.conversation-thread-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid rgba(0, 255, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 12px;
}

.thread-back-btn {
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid rgba(0, 255, 0, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    color: #00ff00;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Courier New', monospace;
}

.thread-back-btn:hover {
    background: rgba(0, 255, 0, 0.2);
    border-color: #00ff00;
}

.thread-partner-info {
    flex: 1;
    display: flex;
    align-items: center;
    color: #00ff00;
    font-size: 1rem;
}

/* Conversation Messages Container */
.conversation-messages {
    max-height: 350px;
    overflow-y: auto;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(0, 255, 0, 0.2);
    border-radius: 8px;
    margin-bottom: 12px;
    scroll-behavior: smooth;
}

/* Mobile: Taller messages container */
@media (max-width: 768px) {
    .conversation-messages {
        max-height: 400px;
    }
}

/* Message Bubble */
.message-bubble {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
}

/* Sent Message (right-aligned, green) */
.message-bubble-sent {
    margin-left: auto;
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.2), rgba(0, 200, 0, 0.15));
    border: 2px solid rgba(0, 255, 0, 0.4);
    text-align: right;
}

/* Received Message (left-aligned, darker) */
.message-bubble-received {
    margin-right: auto;
    background: rgba(0, 255, 0, 0.08);
    border: 2px solid rgba(0, 255, 0, 0.2);
    text-align: left;
}

.message-content {
    color: #00ff00;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 4px;
}

.message-time {
    font-size: 0.7rem;
    color: rgba(0, 255, 0, 0.5);
    margin-top: 4px;
}

/* Conversation Reply Box */
.conversation-reply-box {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.conversation-reply-box textarea {
    flex: 1;
    min-height: 60px;
}

/* Scrollbar for messages */
.conversation-messages::-webkit-scrollbar {
    width: 6px;
}

.conversation-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.conversation-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 0, 0.3);
    border-radius: 3px;
}

.conversation-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 0, 0.5);
}

/* ============================================
   SETTINGS TAB
   ============================================ */

/* Settings Section */
.settings-section {
    margin-bottom: 20px;
    padding: 12px;
    background: rgba(0, 255, 0, 0.05);
    border: 2px solid rgba(0, 255, 0, 0.2);
    border-radius: 8px;
}

.settings-section-title {
    font-weight: bold;
    font-size: 0.9rem;
    color: #00ff00;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 255, 0, 0.2);
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.4);
}

/* Settings Info Grid */
.settings-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.settings-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(0, 255, 0, 0.2);
    border-radius: 6px;
}

.settings-label {
    font-size: 0.75rem;
    color: rgba(0, 255, 0, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-value {
    font-size: 0.9rem;
    color: #00ff00;
    font-weight: bold;
}

/* Mobile: Single column */
@media (max-width: 480px) {
    .settings-info-grid {
        grid-template-columns: 1fr;
    }
}

/* Settings Toggle */
.settings-toggle-item {
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(0, 255, 0, 0.2);
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.settings-toggle-item:hover {
    border-color: rgba(0, 255, 0, 0.4);
    background: rgba(0, 255, 0, 0.05);
}

.settings-toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #00ff00;
}

.settings-toggle-label span:first-child {
    flex: 1;
}

/* Toggle Switch (Nokia style) */
.settings-toggle-label input[type="checkbox"] {
    display: none;
}

.settings-toggle-slider {
    position: relative;
    width: 50px;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 255, 0, 0.3);
    border-radius: 12px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.settings-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0, 255, 0, 0.5);
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 0 6px rgba(0, 255, 0, 0.5);
}

.settings-toggle-label input[type="checkbox"]:checked + .settings-toggle-slider {
    background: rgba(0, 255, 0, 0.2);
    border-color: #00ff00;
}

.settings-toggle-label input[type="checkbox"]:checked + .settings-toggle-slider::before {
    transform: translateX(26px);
    background: #00ff00;
    box-shadow: 0 0 12px rgba(0, 255, 0, 0.8);
}

/* Settings Action Buttons */
.settings-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: rgba(0, 255, 0, 0.05);
    border: 2px solid rgba(0, 255, 0, 0.3);
    border-radius: 8px;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 8px;
    text-align: left;
}

.settings-action-btn:hover {
    background: rgba(0, 255, 0, 0.1);
    border-color: #00ff00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 0, 0.3);
}

.settings-action-btn:active {
    transform: translateY(0);
}

/* Danger action (red) */
.settings-action-danger {
    background: rgba(255, 0, 0, 0.05);
    border-color: rgba(255, 0, 0, 0.3);
    color: #ff5555;
}

.settings-action-danger:hover {
    background: rgba(255, 0, 0, 0.1);
    border-color: #ff5555;
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.3);
}
