:root {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-red: #ef4444;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --hover-bg: rgba(255, 255, 255, 0.05);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Dynamic Background Shapes */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    animation: drift 20s infinite alternate cubic-bezier(0.5, 0, 0.5, 1);
}

.shape-1 {
    width: 500px;
    height: 500px;
    background: rgba(139, 92, 246, 0.4);
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 600px;
    height: 600px;
    background: rgba(59, 130, 246, 0.3);
    bottom: -200px;
    right: -100px;
    animation-delay: -5s;
}

.shape-3 {
    width: 300px;
    height: 300px;
    background: rgba(239, 68, 68, 0.2);
    top: 40%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(100px, 100px) scale(1.1);
    }
}

/* Main Layout */
.app-container {
    width: 90%;
    max-width: 1200px;
    height: 85vh;
    display: flex;
    gap: 2rem;
    z-index: 10;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

/* Sidebar History */
.sidebar {
    width: 300px;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.icon-youtube {
    color: var(--accent-red);
}

.history-list {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 0.5rem;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.history-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.history-item:hover {
    background: var(--hover-bg);
    border-color: var(--glass-border);
    transform: translateY(-2px);
}

.history-item .title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item .url {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    overflow: hidden;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Form Styles */
.transcription-form-container {
    margin-bottom: 2rem;
}

#transcribe-form {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.input-group {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 0 1rem;
    transition: all 0.3s ease;
}

.input-group:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.input-icon {
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

#youtube-url {
    width: 100%;
    background: transparent;
    border: none;
    color: white;
    padding: 1rem 0;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

#clear-input {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

#clear-input:hover {
    color: white;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 16px;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

/* Result Area */
.result-area {
    flex-grow: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.state-container {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    transition: opacity 0.3s ease;
}

.hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.state-container:not(.hidden) {
    opacity: 1;
    z-index: 1;
}

/* Initial & Loading & Error Styling */
.placeholder-icon {
    font-size: 4rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.pulsing-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    margin-bottom: 1.5rem;
    animation: pulse 1.5s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7);
    }

    100% {
        transform: scale(1.1);
        box-shadow: 0 0 0 20px rgba(139, 92, 246, 0);
    }
}

.loading-state h3 {
    margin-bottom: 0.5rem;
}

.loading-state p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.error-icon {
    font-size: 3rem;
    color: var(--accent-red);
    margin-bottom: 1rem;
}

.error-state h3 {
    margin-bottom: 0.5rem;
}

.error-state p {
    color: var(--text-secondary);
}

/* Success Content */
.transcription-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5rem;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

#result-title {
    font-size: 1.2rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 1rem;
}

.btn-icon-only {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon-only:hover {
    background: var(--hover-bg);
}

.content-box {
    flex-grow: 1;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

#result-text {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1.05rem;
    line-height: 1.6;
    padding: 1rem;
    resize: none;
    outline: none;
}

#result-text::-webkit-scrollbar {
    width: 8px;
}

#result-text::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* Toast Modification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(16, 185, 129, 0.9);
    /* Emerald Green */
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast:not(.hidden) {
    transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column-reverse;
        height: auto;
        min-height: 90vh;
        margin: 2rem 0;
    }

    .sidebar {
        width: 100%;
        height: 300px;
    }

    .main-content {
        min-height: 600px;
    }
}