@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600&display=swap');

/* --- Reset & Variables --- */
:root {
    --bg-primary: #111844;         /* Deep Navy Background */
    --bg-secondary: #0a0e29;       /* Darker Navy space depth */
    --bg-card: rgba(75, 86, 148, 0.15);     /* Muted Violet-Blue glass */
    --border-card: rgba(114, 136, 174, 0.25);  /* Soft Slate Blue outline */
    --primary: #EAE0CF;            /* Warm Cream highlights */
    --primary-glow: rgba(234, 224, 207, 0.15);
    --text-primary: #EAE0CF;       /* Warm Cream text headers */
    --text-secondary: #7288AE;     /* Soft Slate Blue body descriptions */
    --font-title: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background: radial-gradient(circle at 50% 50%, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2rem 1.5rem;
    overflow-x: hidden;
}

/* --- Container Layout --- */
.container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* --- Header Section --- */
header {
    text-align: center;
    margin-top: 1rem;
    position: relative;
}

.header-main {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

.brand {
    font-family: var(--font-title);
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #fff 40%, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand svg {
    stroke: var(--primary);
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 0 8px var(--primary));
}

.key-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.key-toggle-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.key-toggle-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

/* --- Collapsible Key Config Drawer --- */
.key-config-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.4s ease, margin-top 0.4s ease, padding 0.4s ease;
    margin-top: 0;
    padding: 0 1.25rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    backdrop-filter: blur(8px);
}

.key-config-panel.active {
    max-height: 250px;
    opacity: 1;
    margin-top: 1.25rem;
    padding: 1.25rem;
    border-color: var(--border-card);
}

.key-config-title {
    font-family: var(--font-title);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.key-config-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.key-config-text a {
    color: var(--primary);
    text-decoration: none;
}

.key-config-text a:hover {
    text-decoration: underline;
}

.key-input-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.key-input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-card);
    border-radius: 8px;
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    outline: none;
    flex: 1;
    transition: var(--transition);
}

.key-input:focus {
    border-color: var(--primary);
}

/* --- Control Panel (Date Pickers & Actions) --- */
.controls-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 1.25rem;
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

.date-picker-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.date-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.date-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-card);
    border-radius: 8px;
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    outline: none;
    transition: var(--transition);
}

.date-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-card);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.btn:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

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

/* --- Media Viewer Card --- */
.display-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 24px;
    overflow: hidden;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.media-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

.media-content {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}

/* --- Content Panel --- */
.content-panel {
    padding: 2.25rem;
}

.media-title {
    font-family: var(--font-title);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.media-meta {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1.5rem;
}

.media-explanation {
    color: var(--text-secondary);
    font-size: 0.98rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.copyright-tag {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.7;
    font-style: italic;
}

/* --- Skeleton Loading States --- */
.skeleton {
    animation: skeleton-pulse 1.5s infinite ease-in-out;
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

.skeleton-media {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
}

.skeleton-title {
    height: 24px;
    background: rgba(255, 255, 255, 0.05);
    width: 70%;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.skeleton-meta {
    height: 14px;
    background: rgba(255, 255, 255, 0.05);
    width: 30%;
    margin-bottom: 2rem;
    border-radius: 4px;
}

.skeleton-desc-line {
    height: 14px;
    background: rgba(255, 255, 255, 0.05);
    width: 100%;
    margin-bottom: 0.75rem;
    border-radius: 4px;
}

.skeleton-desc-line:last-child {
    width: 60%;
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: rgba(12, 13, 24, 0.95);
    border: 1px solid var(--border-card);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 0.85rem 1.25rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    backdrop-filter: blur(8px);
    transition: opacity 0.5s ease;
}

/* --- Responsive Scaling --- */
@media (max-width: 600px) {
    body {
        padding: 1.5rem 1rem;
    }
    
    .brand {
        font-size: 1.75rem;
    }
    
    .controls-card {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-buttons {
        width: 100%;
    }
    
    .btn {
        flex: 1;
        text-align: center;
    }

    .content-panel {
        padding: 1.5rem;
    }

    .media-title {
        font-size: 1.4rem;
    }
}
