/* Sapero — Oxbridge Library Palette */

:root {
    /* Sapero Dark Mode */
    --bg-base:      #1A1210;
    --bg-surface:   #251A15;
    --bg-elevated:  #33231C;
    --accent:       #7C2D33;
    --accent-hover: #9B3A41;
    --brass:        #B8935A;
    --text-primary: #EDE3D0;
    --text-secondary: #A79686;

    /* Mapped to existing variable names used across all templates */
    --primary:        #7C2D33;
    --primary-hover:  #9B3A41;
    --secondary:      #B8935A;
    --bg:             #1A1210;
    --card-bg:        #251A15;
    --text:           #EDE3D0;
    --text-muted:     #A79686;
    --border:         #3D2D24;
    --success:        #4F6B4A;
    --warning:        #C08A3E;
    --error:          #B5502E;
}

/* Sapero Light Mode */
.light {
    --bg-base:      #F4ECDC;
    --bg-surface:   #FBF7ED;
    --bg-elevated:  #FFFFFF;
    --accent:       #7C2D33;
    --accent-hover: #5C2126;
    --brass:        #96703B;
    --text-primary: #2A1B14;
    --text-secondary: #6E5D4C;

    --primary:        #7C2D33;
    --primary-hover:  #5C2126;
    --secondary:      #96703B;
    --bg:             #F4ECDC;
    --card-bg:        #FBF7ED;
    --text:           #2A1B14;
    --text-muted:     #6E5D4C;
    --border:         #DCCBAE;
    --success:        #3F5A3A;
    --warning:        #9C6A1E;
    --error:          #96401F;
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--bg-elevated, var(--card-bg));
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.35rem 0.7rem;
    border-radius: 2rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: border-color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle:hover {
    border-color: var(--secondary);
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

main {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Navigation */
.nav {
    background: rgba(37, 26, 21, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.light .nav {
    background: rgba(251, 247, 237, 0.85);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0.02em;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

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

.btn-outline:hover {
    background: var(--border);
}

/* Cards */
.card,
.profile-container,
.settings-container,
.create-stream-container {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Streams Grid */
.streams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.stream-card {
    background: var(--card-bg);
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stream-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    border-color: var(--primary);
}

.stream-thumbnail {
    height: 180px;
    background: #000;
    position: relative;
    overflow: hidden;
}

.live-indicator {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--error);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 0.25rem;
    font-weight: 800;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
    }
}

.stream-info {
    padding: 1.25rem;
}

.stream-info h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.stream-info .creator {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text);
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Stream View Layout */
.stream-view-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .stream-view-container {
        flex-direction: row;
    }

    .stream-main {
        flex: 1;
    }

    .stream-sidebar {
        width: 380px;
    }
}

.video-player-wrapper {
    background: #000;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin-bottom: 1.5rem;
}

.chat-container {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 1rem;
    height: 500px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    font-size: 0.95rem;
}

.chat-input-wrapper {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
}

/* Footer */
.footer {
    padding: 4rem 2rem 2rem;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 4rem;
    flex-wrap: wrap;
}

.footer-brand {
    max-width: 300px;
}

.footer-brand .nav-brand {
    display: inline-block;
    margin-bottom: 1rem;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4rem;
}

.footer-column h4 {
    color: var(--text);
    margin-bottom: 1.5rem;
    font-size: 1rem;
    font-weight: 700;
}

.footer-column a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-column a:hover {
    color: var(--primary);
}

.footer-bottom {
    max-width: 1200px;
    margin: 3rem auto 0;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .footer-container {
        flex-direction: column;
        gap: 2rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
}

.form-group-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    cursor: pointer;
}

.form-group-checkbox input {
    width: 1.25rem;
    height: 1.25rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav {
        padding: 1rem 1rem;
    }

    .nav-links {
        gap: 0.75rem;
    }

    .mobile-hide {
        display: none;
    }
}