/**
 * DeezTimeStamps - Clean, Modern Stylesheet
 * Efficient CSS with proper theming and responsive design
 */

:root {
    /* Dark theme (default) */
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-card: #252525;
    --bg-input: #333333;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --primary: #6a11cb;
    --primary-light: #7c3aed;
    --primary-dark: #5b21b6;
    --secondary: #2575fc;
    --accent: #ff9800;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border: #3a3a3a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: 0.3s ease;
    --header-height: 64px;
}

[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f1f3f5;
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --border: #dee2e6;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    background-color: var(--bg-secondary);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: transform var(--transition);
}

.logo:hover {
    transform: scale(1.05);
}

.logo i {
    color: var(--primary);
    font-size: 1.5rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all var(--transition);
}

.theme-toggle:hover {
    background-color: var(--bg-input);
    color: var(--text-primary);
}

/* User menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.user-avatar.large {
    width: 50px;
    height: 50px;
    font-size: 20px;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.user-level {
    font-size: 12px;
    color: var(--text-secondary);
}

.auth-buttons {
    display: flex;
    gap: 10px;
}

/* Main content */
.main-content {
    flex: 1;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Cards */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
}

.card-header i {
    color: var(--primary);
}

/* User profile card */
.user-profile .profile-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-profile .user-details h4 {
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.user-profile .user-details p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 10px;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 12px 20px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: color var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab:hover {
    color: var(--primary-light);
}

.tab.active {
    color: var(--primary);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* Input method selector */
.input-method-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.input-group {
    display: none;
    margin-bottom: 20px;
}

.input-group.active {
    display: block;
}

/* Form elements */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition);
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.1);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Options row */
.options-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.options-row .form-group {
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

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

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

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

.btn-full {
    width: 100%;
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color var(--transition);
}

.btn-logout:hover {
    color: var(--error);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary {
    background-color: rgba(106, 17, 203, 0.2);
    color: var(--primary-light);
}

/* Results */
.results-container {
    background-color: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 20px;
}

.results-container h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.format-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
}

.format-switcher label {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.format-switcher select {
    padding: 8px 12px;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.format-switcher select:focus {
    outline: none;
    border-color: var(--primary);
}

#dynamic-output {
    transition: opacity 0.15s ease;
}

.timestamp-item {
    display: flex;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.timestamp-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.timestamp-time {
    font-family: 'Roboto Mono', monospace;
    color: var(--primary);
    font-weight: 600;
    min-width: 80px;
    margin-right: 15px;
    font-size: 14px;
}

.timestamp-content {
    flex: 1;
}

.timestamp-title {
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.timestamp-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Hierarchical timestamp styles */
.timestamp-item.chapter {
    background-color: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 15px;
    margin-bottom: 8px;
    border-left: 4px solid var(--primary);
}

.timestamp-item.chapter .timestamp-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--primary);
}

.timestamp-item.chapter .timestamp-description {
    color: var(--text-primary);
    font-weight: 500;
}

.timestamp-item.section.indented {
    margin-left: 25px;
    padding-left: 20px;
    border-left: 2px solid var(--border);
    background-color: var(--bg-secondary);
    margin-bottom: 5px;
}

.timestamp-item.section.indented .timestamp-title {
    font-size: 14px;
    color: var(--text-primary);
}

.timestamp-item.section.indented .timestamp-description {
    font-size: 13px;
    color: var(--text-secondary);
}

.timestamp-item.section.indented .timestamp-time {
    color: var(--text-secondary);
    font-size: 12px;
    min-width: 70px;
}

/* Table format styles */
.table-format {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-family: monospace;
    font-size: 14px;
}

.table-header {
    display: flex;
    background-color: var(--bg-card);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
}

.table-row {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.table-row:nth-child(even) {
    background-color: var(--bg-secondary);
}

.table-cell {
    flex: 1;
    padding: 8px 12px;
    border-right: 1px solid var(--border);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-cell:first-child {
    flex: 0 0 80px; /* Time column */
}

.table-cell:nth-child(2) {
    flex: 0 0 100px; /* Duration column */
}

.table-cell:last-child {
    flex: 0 0 80px; /* Type column */
    border-right: none;
}

/* Detailed format styles */
.timestamp-item.detailed .timestamp-meta {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 4px;
}

.results-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 30px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: slideUp 0.4s ease;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition);
    background: none;
    border: none;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-content h2 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.modal-content p {
    margin-bottom: 25px;
    color: var(--text-secondary);
}

.modal-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
}

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

.modal-footer a:hover {
    text-decoration: underline;
}

/* Checkbox styling */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.checkmark {
    flex-shrink: 0;
    margin-top: 2px;
}

/* Password strength meter */
.password-strength {
    margin-top: 8px;
}

.strength-meter {
    width: 100%;
    height: 4px;
    background-color: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 5px;
}

.strength-fill {
    height: 100%;
    width: 0%;
    background-color: var(--error);
    border-radius: 2px;
    transition: all var(--transition);
}

.strength-text {
    font-size: 12px;
    color: var(--text-muted);
}

/* Messages */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--bg-card);
    color: var(--text-primary);
    padding: 15px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10001;
    animation: slideInRight 0.3s ease;
    max-width: 400px;
}

.message-success {
    border-color: var(--success);
}

.message-error {
    border-color: var(--error);
}

.message-success i {
    color: var(--success);
}

.message-error i {
    color: var(--error);
}

.message-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    margin-left: auto;
    font-size: 16px;
    transition: color var(--transition);
}

.message-close:hover {
    color: var(--text-primary);
}

/* Loader */
.loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: var(--text-secondary);
}

.loader i {
    font-size: 18px;
    color: var(--primary);
}

/* Success/Error messages */
.success-message {
    color: var(--success);
}

.error-message {
    color: var(--error);
}

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

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

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        padding: 15px;
    }
    
    .card {
        padding: 15px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .options-row {
        flex-direction: column;
        gap: 0;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .header-actions {
        gap: 10px;
    }
    
    .user-info {
        display: none;
    }
    
    .input-method-selector {
        flex-direction: column;
    }
    
    .modal-content {
        padding: 20px;
        margin: 10px;
    }
    
    .message {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .logo span {
        display: none;
    }
    
    .tabs {
        gap: 5px;
    }
    
    .tab {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 13px;
    }
}

/* History Styles */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-item {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition);
}

.history-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.history-title-area {
    flex: 1;
    margin-right: 15px;
}

.history-title {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.channel-id {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 4px;
}

.channel-id i {
    font-size: 11px;
    opacity: 0.7;
}

.history-date {
    color: var(--text-muted);
    font-size: 13px;
    white-space: nowrap;
}

.history-item-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.video-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color var(--transition);
}

.video-link:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.history-stats {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: var(--text-secondary);
}

.history-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-stats i {
    font-size: 12px;
    opacity: 0.8;
}

.history-actions {
    display: flex;
    justify-content: flex-end;
}

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

.no-history {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.no-history i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.no-history p {
    font-size: 18px;
    margin-bottom: 8px;
}

.no-history small {
    font-size: 14px;
    opacity: 0.8;
}

.error-message {
    text-align: center;
    padding: 30px 20px;
    color: var(--error);
}

.error-message i {
    font-size: 36px;
    margin-bottom: 12px;
}

.error-message p {
    font-size: 16px;
    margin: 0;
}

/* Responsive history */
@media (max-width: 768px) {
    .history-item-header {
        flex-direction: column;
        gap: 8px;
    }
    
    .history-title {
        margin-right: 0;
    }
    
    .history-item-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .history-stats {
        flex-wrap: wrap;
    }
}

/* Format Preview Styles */
#format-preview {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 15px;
    margin-top: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
    min-height: 120px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    position: relative;
    transition: var(--transition);
}

#format-preview:hover {
    border-color: var(--primary);
}

#format-preview pre {
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    white-space: pre-wrap;
    color: var(--text-primary);
}

#format-preview p {
    margin: 0;
    color: var(--text-muted);
    font-style: italic;
}

/* Format preview content styling */
#format-preview pre .chapter {
    color: var(--primary);
    font-weight: 600;
}

#format-preview pre .section {
    color: var(--secondary);
    margin-left: 20px;
}

#format-preview pre .hierarchy-section {
    color: var(--accent);
    margin-left: 10px;
}

/* Loading state for preview */
#format-preview.loading {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-secondary) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Responsive format preview */
@media (max-width: 768px) {
    #format-preview {
        font-size: 12px;
        padding: 12px;
        max-height: 150px;
    }
}

/* Progress Loader Styles */
.progress-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.progress-text {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.progress-text i {
    color: var(--primary);
}

.progress-bar {
    width: 100%;
    max-width: 300px;
    height: 8px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: var(--radius-sm);
    transition: width 0.5s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: progress-shine 1.5s infinite;
}

.progress-percentage {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

@keyframes progress-shine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Enhanced loader with progress */
.progress-loader .fas {
    animation: fa-spin 1s linear infinite;
}