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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #e5e7eb;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --surface-hover: #334155;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --accent-color: #8b5cf6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.page {
    min-height: 100vh;
}

.page.hidden {
    display: none;
}

/* Login Page */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-container h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

.discord-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.discord-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.4);
}

.error-message {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(237, 66, 69, 0.1);
    border: 1px solid var(--danger-color);
    border-radius: 8px;
    color: var(--danger-color);
}

.error-message.hidden {
    display: none;
}

/* Header */
.header {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
}

.header-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-size: 1.5rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

.user-name {
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

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

.btn-secondary {
    background: var(--surface-hover);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    border-color: var(--text-muted);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

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

/* Calendar Navigation */
.calendar-nav {
    max-width: 100%;
    margin: 1rem auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.current-week {
    flex: 1;
    text-align: center;
    font-size: 1.3rem;
}

/* Calendar */
.calendar {
    max-width: 100%;
    margin: 0 auto 1rem;
    padding: 0 1rem 1rem;
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    gap: 1px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100vh - 180px);
}

.calendar-header {
    background: var(--surface-color);
    padding: 0.5rem;
    font-weight: 600;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 0.9rem;
}

.calendar-time {
    background: var(--surface-color);
    padding: 0.35rem;
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-right: 1px solid var(--border-color);
}

.calendar-cell {
    background: var(--bg-color);
    min-height: 50px;
    padding: 0.2rem;
    position: relative;
    cursor: pointer;
    transition: background 0.2s ease;
}

.calendar-cell:hover {
    background: var(--surface-hover);
}

.calendar-cell.today {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.stream-session {
    position: absolute;
    left: 2px;
    right: 2px;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    overflow: hidden;
    border-left: 3px solid;
    transition: all 0.2s ease;
    z-index: 5;
}

.stream-session:hover {
    transform: translateX(2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 6;
}

.stream-session-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.stream-session-time {
    font-size: 0.75rem;
    color: #f1f5f9;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.stream-session-collabs {
    font-size: 0.7rem;
    margin-top: 0.25rem;
    color: #f1f5f9;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Session View */
.session-view {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.view-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.view-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.view-value {
    font-size: 1rem;
    color: var(--text-color);
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface-color);
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

.modal-header h2 {
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 1;
}

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

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Form */
.form-group {
    margin-bottom: 1.25rem;
}

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 1rem;
    font-family: inherit;
}

.form-group input[type="color"] {
    height: 50px;
    cursor: pointer;
    padding: 0.25rem;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.collab-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.collab-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.collab-item:hover {
    background: var(--surface-hover);
}

.collab-item.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.collab-checkbox {
    width: 18px;
    height: 18px;
}

.external-collab-input {
    display: flex;
    gap: 0.5rem;
}

.external-collab-input input {
    flex: 1;
}

.external-collabs-list {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.external-collab-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface-hover);
    border-radius: 6px;
}

.external-collab-tag button {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .calendar {
        grid-template-columns: 60px repeat(7, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .calendar-nav {
        flex-direction: column;
    }

    .current-week {
        order: -1;
    }
}

/* Administration */
.admin-section {
    margin-bottom: 2rem;
}

.admin-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.admin-section .external-collab-input {
    margin-top: 0.75rem;
}

.admin-section .external-collab-input input {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    color: var(--text-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.admin-section .external-collab-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.admin-section .external-collab-input input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.whitelist-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}

.whitelist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.whitelist-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.whitelist-item-id {
    font-family: monospace;
    font-weight: 600;
    color: var(--text-color);
}

.whitelist-item-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.whitelist-item.admin {
    border-left: 3px solid var(--primary-color);
}

.whitelist-item.config {
    border-left: 3px solid var(--success-color);
}

/* Subscribe Modal */
.subscribe-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.subscribe-section > p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.qr-code-section {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}

.qr-code-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#qr-code {
    display: flex;
    justify-content: center;
    align-items: center;
}

#qr-code img {
    display: block;
    image-rendering: pixelated;
}

.qr-code-help {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 250px;
}

.subscribe-url-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.subscribe-url-section label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.subscribe-url-input {
    display: flex;
    gap: 0.5rem;
}

.subscribe-url-input input {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 0.9rem;
    font-family: monospace;
}

.subscribe-instructions h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.instruction-item {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.instruction-item h4 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.instruction-item h4 i {
    font-size: 1.1rem;
}

.instruction-item ol {
    margin-left: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.instruction-item ol li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.instruction-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.instruction-item a:hover {
    text-decoration: underline;
}

.hidden {
    display: none;
}
