:root {
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --secondary: #1e40af;
    --bg-dark: #000000;
    --bg-card: #0a0a0a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-morning: #f59e0b;
    --accent-evening: #6366f1;
    --accent-general: #10b981;
    --glass: rgba(10, 10, 20, 0.7);
    --border: rgba(30, 58, 138, 0.3);
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.8);
    --font-main: 'Outfit', system-ui, sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 1rem;
    padding-bottom: 2rem;
    background: radial-gradient(circle at 10% 20%, #1e1b4b 0%, #000000 40%),
        radial-gradient(circle at 90% 80%, #172554 0%, #000000 40%);
    background-size: 200% 200%;
    animation: gradientMove 15s ease infinite;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.app-container {
    width: 100%;
    max-width: 650px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (max-width: 480px) {
    .app-container {
        padding: 0.75rem 0.5rem;
        gap: 1rem;
    }

    .header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .logo {
        font-size: 1.25rem;
    }

    .header-actions {
        gap: 0.75rem;
    }

    .current-date {
        font-size: 0.8rem;
    }

    .roster-card {
        padding: 1.25rem 1rem;
        border-radius: 16px;
    }

    .schedule-row {
        padding: 1rem;
        gap: 1rem;
    }

    .time-badge {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        gap: 0.4rem;
    }

    .time-badge.oslo {
        font-size: 0.7rem;
    }
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    animation: fadeInDown 0.8s ease-out;
    width: 100%;
}

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

.icon-btn-header {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 1rem;
}

.icon-btn-header:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: var(--primary);
    transform: rotate(45deg);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
    text-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.logo i {
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary));
}

.current-date {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Roster Card */
.roster-card {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 2rem 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
    transition: transform 0.3s ease;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.roster-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    text-align: center;
}

.week-info h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--primary-light);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.nav-btn:active {
    transform: translateY(0) scale(0.95);
}

/* Schedule Grid */
.schedule-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.schedule-row {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    transition: all 0.3s ease;
    width: 100%;
}

.schedule-row:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.row-main {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.col-time {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.75rem;
    width: 100%;
}

@media (min-width: 480px) {
    .col-time {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.shift-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.time-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}

@media (min-width: 480px) {
    .time-group {
        align-items: flex-end;
    }
}


.time-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    width: fit-content;
    white-space: nowrap;
}

.time-badge.oslo {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
    border: 1px solid rgba(148, 163, 184, 0.15);
    font-size: 0.75rem;
}

.time-badge.oslo i {
    color: var(--primary-light);
    opacity: 0.8;
}

.time-badge.morning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-morning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.time-badge.evening {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-evening);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.time-badge.general {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-general);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.shift-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-left: 0.25rem;
}

/* Col: Person */
.col-person {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.assignee-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.person-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.person-info .name {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-main);
}

.person-info .role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Col: Action */
.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.75rem;
    border-radius: 50%;
    transition: all 0.2s;
    opacity: 0.4;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    opacity: 1;
}

/* Modal and Footer styles (kept mostly same but refined) */
.work-days-info {
    display: flex;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem 2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.work-days-info p {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.work-days-info i {
    color: var(--primary-light);
}

footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 600px) {
    .schedule-row {
        grid-template-columns: 1fr auto;
        gap: 1rem;
    }

    .col-time {
        grid-column: 1 / -1;
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 0.5rem;
        gap: 0.75rem;
    }

    .col-person {
        grid-column: 1;
    }

    .col-action {
        grid-column: 2;
    }
}

/* Modal Stuffs (Preserved) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.modal-content {
    background: #0f172a;
    /* Solid dark background for readability */
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(0);
    transition: transform 0.3s;
}

.modal.hidden .modal-content {
    transform: translateY(20px);
}

.modal h3 {
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.modal p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.select-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.person-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.person-option:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.person-option.selected {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
}

.person-option .name {
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.95rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn-cancel,
.btn-reset,
.btn-save {
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

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

.btn-cancel:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}

.btn-reset {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.btn-reset:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-save {
    background: var(--primary);
    border: 1px solid var(--primary);
    color: white;
}

.btn-save:hover {
    background: var(--primary-light);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.hidden {
    display: none !important;
}

/* Controls Toolbar */
.controls-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
}

.toggle-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.toggle-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
}

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

.reset-link {
    background: transparent;
    border: none;
    color: #ef4444;
    /* Red color indicating reset/action */
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.8;
    transition: all 0.2s;
    font-weight: 500;
}

.reset-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.reset-link.hidden {
    display: none;
}

/* Discord Controls */
.discord-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn-small {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.icon-btn-small:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-discord {
    background: #5865F2;
    border: 1px solid #5865F2;
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-discord:hover {
    background: #4752C4;
    box-shadow: 0 0 15px rgba(88, 101, 242, 0.4);
}

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

/* Discord Config Modal */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}

.webhook-input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: var(--font-main);
    transition: all 0.2s;
}

.webhook-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.webhook-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}


/* Cleanup: All previous fragmented overrides removed and consolidated above */

.col-person {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    padding-left: 0 !important;
}

.row-action {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
    padding-top: 0.5rem !important;
}

.btn-edit-shift {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    /* Mobile full width */
    justify-content: center;
}

.btn-edit-shift:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-edit-shift i {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Avatar Consistency Fix */
.avatar {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    flex-shrink: 0 !important;
    border-radius: 50% !important;
}

@media (max-width: 480px) {
    .time-group {
        align-items: flex-start !important;
        width: 100%;
    }

    .col-time {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    .time-badge {
        width: 100% !important;
        justify-content: flex-start !important;
    }
}

/* Desktop Overrides */
@media (min-width: 768px) {
    .row-main {
        flex-direction: row !important;
        align-items: center !important;
    }

    .col-time {
        flex: 0 0 240px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        border-bottom: none !important;
        border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
        padding-bottom: 0 !important;
        padding-right: 1.5rem !important;
    }

    .col-person {
        flex: 1 !important;
        padding-left: 1.5rem !important;
    }

    .btn-edit-shift {
        width: auto !important;
        /* Desktop natural width */
        min-width: 160px !important;
    }
}

.persistence-warning {
    display: none;
    align-items: center;
    gap: 8px;
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-top: 15px;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.persistence-warning.active {
    display: flex;
}

.modal-intro {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}