/* Claude and ChatGPT Chat Downloader - Popup Styles */

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

/* Base Theme - Light Mode */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #1a1a1a;
    --text-secondary: #6c757d;
    --text-tertiary: #9ca3af;
    --accent-primary: #007AFF;
    --accent-secondary: #34C759;
    --accent-warning: #FF9500;
    --accent-danger: #FF3B30;
    --border-color: #e5e7eb;
    --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.15);
    --radius-small: 6px;
    --radius-medium: 10px;
    --radius-large: 16px;
}

/* Dark Theme */
.dark-theme {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --bg-tertiary: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-tertiary: #8a8a8a;
    --accent-primary: #0A84FF;
    --accent-secondary: #30D158;
    --accent-warning: #FF9F0A;
    --accent-danger: #FF453A;
    --border-color: #404040;
    --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.4);
}

body {
    width: 400px;
    min-height: 600px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    transition: all 0.2s ease;
}

.header {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #667eea 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.header p {
    font-size: 12px;
    opacity: 0.9;
    font-weight: 500;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-switch {
    position: relative;
    width: 42px;
    height: 24px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#dark-mode:checked + .toggle-switch {
    background: rgba(255, 255, 255, 0.5);
}

#dark-mode:checked + .toggle-switch::before {
    transform: translateX(18px);
}

#dark-mode {
    display: none;
}

.container {
    padding: 20px;
}

.section {
    background: var(--bg-secondary);
    border-radius: var(--radius-medium);
    margin-bottom: 16px;
    padding: 18px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.section:hover {
    box-shadow: var(--shadow-medium);
}

.section h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.primary-action {
    border: 2px solid var(--accent-primary);
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.primary-action h2 {
    color: var(--accent-primary);
    font-size: 14px;
    margin-bottom: 12px;
}

.btn {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-small);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.btn:last-child {
    margin-bottom: 0;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

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

.btn-primary:hover:not(:disabled) {
    background: #0056cc;
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #28a745;
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.btn-tertiary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-tertiary:hover:not(:disabled) {
    background: var(--border-color);
    color: var(--text-primary);
}

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

.btn-danger:hover:not(:disabled) {
    background: #d32f2f;
    transform: translateY(-1px);
}

.btn-small {
    padding: 8px 12px;
    font-size: 12px;
}

.active-tabs {
    max-height: 240px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.active-tabs::-webkit-scrollbar {
    width: 6px;
}

.active-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.active-tabs::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.tab-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-small);
    padding: 12px;
    margin-bottom: 10px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.tab-item:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
    border-color: var(--accent-primary);
}

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

.platform-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.platform-icon {
    font-size: 16px;
}

.platform-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.export-tab-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-tab-btn:hover {
    background: #0056cc;
    transform: scale(1.05);
}

.export-tab-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.tab-details {
    font-size: 11px;
    color: var(--text-secondary);
}

.tab-url {
    margin-bottom: 2px;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    word-break: break-all;
}

.last-active {
    font-size: 10px;
    color: var(--text-tertiary);
}

.no-tabs {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px 20px;
}

.no-tabs-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.7;
}

.no-tabs p {
    margin-bottom: 8px;
    line-height: 1.4;
}

.no-tabs strong {
    color: var(--text-primary);
}

.shortcut-hint {
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-small);
    font-size: 11px;
}

.setting-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-label {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}

.action-group {
    display: flex;
    gap: 8px;
}

.action-group .btn {
    margin-bottom: 0;
}

.footer {
    padding: 16px 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.footer-stats {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.kbd {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 10px;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-medium);
    padding: 20px;
    max-width: 350px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
}

.modal-content h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: 16px;
}

.history-list {
    margin-bottom: 16px;
}

.history-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.history-item:last-child {
    border-bottom: none;
}

.history-date {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.history-count {
    font-size: 14px;
    color: var(--accent-primary);
    font-weight: 600;
}

.history-platforms {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.history-summary {
    font-weight: 600;
    text-align: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-small);
    margin-bottom: 16px;
    color: var(--accent-primary);
}

.modal-close {
    width: 100%;
    padding: 10px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-small);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #0056cc;
    transform: translateY(-1px);
}

/* Smooth animations */
.section, .btn, .tab-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus styles for accessibility */
.btn:focus,
.checkbox:focus,
.export-tab-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
}

/* Loading states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn:disabled:hover {
    transform: none !important;
    background: var(--accent-primary) !important;
}

/* Export status indicators */
.export-success {
    background: var(--accent-secondary) !important;
}

.export-error {
    background: var(--accent-danger) !important;
}

.export-warning {
    background: var(--accent-warning) !important;
}

/* Responsive adjustments */
@media (max-width: 420px) {
    body {
        width: 360px;
    }
    
    .container {
        padding: 16px;
    }
    
    .section {
        padding: 14px;
    }
    
    .header {
        padding: 16px;
    }
    
    .header h1 {
        font-size: 16px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
    }
    
    .dark-theme {
        --border-color: #ffffff;
        --text-secondary: #ffffff;
    }
}