:root {
    /* Light theme colors */
    --bg-primary: #f8f9fa;
    --bg-secondary: #e9ecef;
    --bg-tertiary: #dee2e6;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #ced4da;
    --header-bg: #ffffff;
    --toggle-bg: #f8f9fa;
    --toggle-border: #ced4da;
}

[data-theme="dark"] {
    /* Dark theme colors */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #404040;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --border-color: #404040;
    --header-bg: #2d2d2d;
    --toggle-bg: #404040;
    --toggle-border: #555555;
}

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

body {
    height: 100vh;
    font-family: Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.layout-container {
    display: grid;
    grid-template-columns: minmax(150px, 20%) 1fr minmax(150px, 20%);
    grid-template-rows: 90px auto;
    height: 100vh;
    gap: 0;
}

/* iPhone Container */
.iphone-container {
    width: 375px;
    height: 812px;
    background: linear-gradient(145deg, #2c2c2e, #1c1c1e);
    border-radius: 40px;
    padding: 10px;
    box-shadow: 
        0 0 0 12px #000,
        0 0 0 14px #333,
        0 20px 40px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    position: relative;
    transform: scale(0.85);
}

/* iPhone Screen */
.iphone-screen {
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 30px;
    overflow: hidden;
    position: relative;
}

/* Dynamic Island (Notch) */
.dynamic-island {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 35px;
    background: #000;
    border-radius: 20px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.dynamic-island::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #00ff88;
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Status Bar */
.status-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    z-index: 5;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-right {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* iPhone Content */
.iphone-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    color: #ffffff;
}

/* Avatar Section */
.avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 5px 20px;
    gap: 10px;
    background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
}

.avatar-container {
    width: 355px;
    height: 355px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 
        0 10px 30px rgba(102, 126, 234, 0.3),
        inset 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.avatar-placeholder {
    font-size: 80px;
    color: #fff;
    width: 355px;
    height: 355px;
    background-image: url('images/bust1.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 50%;
}

.avatar-status {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    background: #00ff88;
    border-radius: 50%;
    border: 3px solid #1a1a1a;
    animation: pulse 2s infinite;
}

/* Text Section */
.text-section {
    height: 300px;
    background: #2d2d2d;
    border-top: 1px solid #404040;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.chat-display {
    flex: 1;
    background: #1a1a1a;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
    overflow-y: auto;
    border: 1px solid #404040;
}

.chat-message {
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 10px;
    background: #404040;
    color: #ffffff;
    font-size: 14px;
}

.chat-message.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    margin-left: 40px;
}

.chat-message.ai {
    background: #404040;
    margin-right: 40px;
}

.typing-indicator {
    opacity: 0.7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    margin-right: 40px;
    background: #404040;
    border-radius: 10px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background-color: #ffffff;
    border-radius: 50%;
    opacity: 0.3;
    animation: typingDots 1.4s infinite;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDots {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Chat input container layout */
.chat-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.text-input {
    flex: 1;
    padding: 12px 45px 12px 15px; /* Add right padding for mic icon */
    border: 1px solid #404040;
    border-radius: 20px;
    background: #1a1a1a;
    color: #ffffff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
    overflow-x: auto;
    white-space: nowrap;
    scroll-behavior: smooth;
}

.text-input:focus {
    border-color: #667eea;
}

/* Input container for mic button positioning */
.input-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

/* Microphone button */
.mic-button {
    position: absolute;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.mic-button:hover {
    color: #888888;
    background: rgba(102, 126, 234, 0.1);
}

.mic-button.recording {
    color: #87ceeb;
    background: rgba(135, 206, 235, 0.1);
    animation: pulse-red 2s infinite;
}

.mic-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.send-button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.send-button:hover {
    transform: scale(1.1);
}

.send-button:active {
    transform: scale(0.95);
}

.send-icon {
    width: 20px;
    height: 20px;
}

.left-column {
    grid-column: 1;
    grid-row: 1 / 3; /* Span both rows */
    background-color: var(--bg-secondary);
}

.right-column {
    position: fixed;
    top: 0;
    right: -300px; /* Hidden by default */
    width: 300px; /* Default width */
    height: 100vh;
    background-color: var(--bg-secondary); /* Same as left column */
    transition: right 0.3s ease;
    z-index: 1000;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

/* Dynamic width classes */
.right-column.width-small {
    width: 150px;
    right: -150px;
}

.right-column.width-medium {
    width: 200px;
    right: -200px;
}

.right-column.width-large {
    width: 250px;
    right: -250px;
}

.right-column.width-xlarge {
    width: 300px;
    right: -300px;
}

.right-column:hover {
    right: 0; /* Slide in on hover */
}

.right-column .section-label {
    padding: 20px;
    text-align: center;
    font-weight: bold;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    margin: 10px;
    border-radius: 4px;
}

/* Add tab indicator for hidden right column */
.right-column::before {
    content: '›';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 60px;
    background-color: var(--bg-secondary); /* Same as left column */
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    border-radius: 10px 0 0 10px;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.right-column:hover::before {
    content: '‹';
    left: -20px;
}

.header {
    grid-column: 2 / 4; /* Start at column 2, span through column 4 to right edge */
    grid-row: 1;
    background-color: var(--header-bg);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 90px;
    position: relative;
    padding: 0 20px;
    width: 100%;
    z-index: 1; /* Below overlay right column (z-index: 1000) */
}

/* Hardware Information */
.hardware-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 11px;
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.hardware-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    background: var(--bg-tertiary);
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.hardware-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2px;
    font-size: 10px;
}

.hardware-icon {
    color: #60a5fa; /* text-blue-400 default */
    flex-shrink: 0;
}

.hardware-icon.hardware-icon-green {
    color: #4ade80 !important; /* text-green-400 like web4 */
}

.hardware-icon.hardware-icon-purple {
    color: #a78bfa !important; /* text-purple-400 like web4 */
}

/* Site Title in Main Container */
.site-title-main {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    grid-column: 1 / -1; /* Span all columns */
    text-align: center;
    z-index: 1000; /* On top of everything */
}

/* Site Title (matching web4) */
.site-title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.text-4xl {
    font-size: 2.25rem;
    line-height: 2.5rem;
}

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

.bg-gradient-to-r {
    background-image: linear-gradient(to right, var(--tw-gradient-stops));
}

.from-blue-400 {
    --tw-gradient-from: #60a5fa;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgb(96 165 250 / 0));
}

.to-purple-600 {
    --tw-gradient-to: #9333ea;
}

.bg-clip-text {
    -webkit-background-clip: text;
    background-clip: text;
}

.text-transparent {
    color: transparent;
}

.text-gray-400 {
    color: #9ca3af;
}

/* User Status in Header */
.user-status {
    position: absolute;
    right: 70px; /* Position left of theme toggle */
    bottom: 20px; /* Changed from top: 50% to bottom: 20px */
    transform: translateY(0); /* Removed vertical centering */
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px; /* Reduced from 24px to 20px (15% reduction) */
    color: var(--text-secondary);
}

.user-status span#username {
    font-family: 'Merriweather', serif;
    font-weight: 400;
    color: var(--text-primary);
}

.user-status button {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 11px; /* Reverted from 22px back to 11px */
}

.user-status button:hover {
    background: var(--bg-primary);
}

/* Ensure hidden class works properly */
.user-status button.hidden {
    display: none !important;
}

.user-status span.hidden {
    display: none !important;
}

.hidden {
    display: none !important;
}

/* Theme Toggle */
.theme-toggle {
    position: absolute;
    right: 20px;
    top: 20px;  /* Changed from 50% to 20px for top alignment */
    transform: translateY(0); /* Removed vertical centering */
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* Dark theme: white button with sun (shows what you'll get - light theme) */
[data-theme="dark"] .theme-toggle {
    background: #ffffff;
    border: 2px solid #e5e7eb;
}

/* Light theme: dark button with moon (shows what you'll get - dark theme) */
[data-theme="light"] .theme-toggle {
    background: #1a1a1a;
    border: 2px solid #404040;
}

.theme-toggle:hover {
    opacity: 0.8;
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
}

/* Icon colors */
[data-theme="dark"] .theme-toggle svg {
    fill: #1a1a1a; /* Dark icon on white button */
}

[data-theme="light"] .theme-toggle svg {
    fill: #ffffff; /* Light icon on dark button */
}

.main-body {
    grid-column: 2;
    grid-row: 2;
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.section-label {
    padding: 10px;
    text-align: center;
    font-weight: bold;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    margin: 10px;
    border-radius: 4px;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background: var(--bg-tertiary);
}

.theme-toggle:hover {
    background-color: var(--bg-tertiary);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: var(--text-primary);
    transition: opacity 0.3s ease;
}

.theme-toggle .sun-icon {
    display: block;
}

.theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: block;
}

/* Section labels for verification */
.section-label {
    padding: 10px;
    text-align: center;
    font-weight: bold;
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
    margin: 10px;
    border-radius: 4px;
}

.header .section-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    font-size: 14px;
    background-color: var(--bg-secondary);
    border-radius: 4px;
}

/* Girlfriend Name Section */
.girlfriend-name-section {
    padding: 20px 10px;
    margin-top: 20px;
}

.name-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
}

.name-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    margin-bottom: 10px;
    transition: border-color 0.3s ease;
}

.name-input:focus {
    border-color: #667eea;
}

.name-button, .change-button {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.name-button:hover, .change-button:hover {
    transform: scale(1.05);
}

.name-button:active, .change-button:active {
    transform: scale(0.95);
}

.name-display {
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
    text-align: center;
}

.name-value {
    color: #667eea;
    font-weight: 600;
    font-size: 14px;
}

.hidden {
    display: none !important;
}

/* Personality Section */
.personality-section {
    padding: 20px 10px;
    margin-top: 20px;
}

.personality-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.personality-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.personality-option:hover {
    background: var(--bg-secondary);
    border-color: #667eea;
}

.personality-option input[type="radio"] {
    margin-right: 10px;
    accent-color: #667eea;
}

.personality-option input[type="radio"]:checked + .personality-label {
    color: #667eea;
    font-weight: 600;
}

.personality-label {
    font-size: 14px;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.premium-badge {
    margin-left: auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.premium-notice {
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    transition: opacity 0.5s ease;
}

.premium-notice.hiding {
    opacity: 0;
}

.premium-notice.hidden {
    display: none;
}

.premium-notice a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.premium-notice a:hover {
    text-decoration: underline;
}

.personality-option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.personality-option.disabled input[type="radio"] {
    cursor: not-allowed;
}

.personality-option.disabled .personality-label {
    color: var(--text-secondary);
}

/* Battery Indicator Styles */
#battery-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

#battery-svg {
    transition: all 0.3s ease;
}

#battery-fill {
    transition: all 0.3s ease;
}

#battery-tip {
    transition: all 0.3s ease;
}

#battery-outline {
    transition: all 0.3s ease;
}

/* Battery level animations */
@keyframes battery-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

#battery-fill.low-battery {
    animation: battery-pulse 2s infinite;
}

/* Battery tooltip */
#battery-icon::after {
    content: attr(data-level);
    position: absolute;
    top: -25px;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#battery-icon:hover::after {
    opacity: 1;
}

/* Voice Toggle in iPhone Gray Border */
.voice-toggle-in-border {
    position: absolute;
    left: 0px;
    top: 12%;
    transform: translateY(-50%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Display Wrapper for Vertical Toggle */
.chat-display-wrapper {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 100%;
    position: relative;
}

/* Vertical Voice Toggle Switch Styles */
.voice-toggle-vertical {
    display: flex;
    align-items: center;
    padding: 2px 0 2px 0;
    height: 100%;
    justify-content: flex-start;
    flex-shrink: 0;
}

.toggle-switch-vertical {
    position: relative;
    display: inline-block;
    width: 10px;
    height: 33px;
}

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

.toggle-slider-vertical {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #000;
    transition: .4s;
    border-radius: 17px;
}

.toggle-slider-vertical:before {
    position: absolute;
    content: "";
    height: 7px;
    width: 7px;
    left: 1.5px;
    top: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider-vertical {
    background-color: #667eea;
}

input:checked + .toggle-slider-vertical:before {
    top: 24px;
}

/* Continuous mode indicator for vertical toggle */
.continuous-mode-active-vertical {
    background: rgba(102, 126, 234, 0.1) !important;
    border-color: #667eea !important;
}

.continuous-mode-indicator-vertical {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    animation: pulse-red 2s infinite;
}
