/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

h1 {
    font-size: 2rem;
    color: #222;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1rem;
}

h2 {
    font-size: 1.5rem;
    margin-top: 30px;
    margin-bottom: 15px;
    color: #333;
}

/* Section Management */
.section {
    margin-bottom: 30px;
}

.hidden {
    display: none !important;
}

/* Form Styles */
#transcript-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#url-input {
    padding: 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    width: 100%;
    transition: border-color 0.3s;
}

#url-input:focus {
    outline: none;
    border-color: #007bff;
}

button {
    padding: 15px 25px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 44px;
    min-width: 44px;
}

#submit-btn {
    background-color: #007bff;
    color: white;
}

#submit-btn:hover {
    background-color: #0056b3;
}

#submit-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.secondary-btn {
    background-color: #6c757d;
    color: white;
}

.secondary-btn:hover {
    background-color: #545b62;
}

.action-btn {
    background-color: #28a745;
    color: white;
    font-size: 14px;
    padding: 10px 20px;
}

.action-btn:hover {
    background-color: #218838;
}

/* Loading Spinner */
#loading-section {
    text-align: center;
    padding: 40px 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.status-text {
    color: #666;
    font-size: 1.1rem;
}

/* Error Display */
.error-box {
    background-color: #f8d7da;
    border: 2px solid #f5c6cb;
    border-radius: 6px;
    padding: 20px;
    text-align: center;
}

.error-box h2 {
    color: #721c24;
    margin-top: 0;
}

#error-message {
    color: #721c24;
    font-weight: 600;
    margin: 15px 0;
}

.error-suggestion {
    color: #856404;
    font-style: italic;
    margin-bottom: 20px;
}

/* Results Header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 20px;
    flex-wrap: wrap;
}

.video-info {
    flex: 1;
    min-width: 250px;
}

.video-info p {
    margin: 5px 0;
    font-size: 0.9rem;
}

#generated-badge {
    display: inline-block;
    background-color: #ffc107;
    color: #333;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 5px;
}

.section-description {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* Snippets Accordion */
.snippets-container {
    margin-bottom: 40px;
}

.snippet-item {
    border: 2px solid #ddd;
    border-radius: 6px;
    margin-bottom: 10px;
    overflow: hidden;
}

.snippet-header {
    background-color: #f8f9fa;
    padding: 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background-color 0.3s;
}

.snippet-header:hover {
    background-color: #e9ecef;
}

.snippet-title {
    font-weight: 600;
    font-size: 1rem;
}

.snippet-meta {
    font-size: 0.85rem;
    color: #666;
}

.expand-icon {
    font-size: 1.2rem;
    transition: transform 0.3s;
}

.snippet-item.expanded .expand-icon {
    transform: rotate(180deg);
}

.snippet-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.snippet-item.expanded .snippet-content {
    max-height: 5000px;
}

.snippet-body {
    padding: 20px;
    background-color: #fff;
    border-top: 1px solid #ddd;
}

.snippet-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.snippet-text {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    max-height: 400px;
    overflow-y: auto;
    font-family: "Courier New", monospace;
    font-size: 0.9rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Full Transcript */
.full-transcript-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.transcript-preview {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    max-height: 500px;
    overflow-y: auto;
    font-family: "Courier New", monospace;
    font-size: 0.9rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid #ddd;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #28a745;
    color: white;
    padding: 15px 25px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-weight: 600;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .results-header {
        flex-direction: column;
    }

    .snippet-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .snippet-controls,
    .full-transcript-controls {
        flex-direction: column;
    }

    .action-btn,
    .secondary-btn {
        width: 100%;
    }

    .toast {
        right: 10px;
        left: 10px;
        bottom: 10px;
    }
}

/* Scrollbar Styling */
.snippet-text::-webkit-scrollbar,
.transcript-preview::-webkit-scrollbar {
    width: 8px;
}

.snippet-text::-webkit-scrollbar-track,
.transcript-preview::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.snippet-text::-webkit-scrollbar-thumb,
.transcript-preview::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.snippet-text::-webkit-scrollbar-thumb:hover,
.transcript-preview::-webkit-scrollbar-thumb:hover {
    background: #555;
}
