/* FitCacheNet - small, single-file stylesheet so the C# is easy to read */
* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    background: #f8fafc;
    color: #0f172a;
}

/* Suppress the browser focus ring on h1 set programmatically by FocusOnNavigate */
h1:focus {
    outline: none;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

    .topbar .brand {
        font-weight: 700;
        font-size: 1.25rem;
        color: #2563eb;
        text-decoration: none;
        letter-spacing: -0.5px;
    }

    .topbar nav {
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }

        .topbar nav .nav-link {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 1rem;
            color: #64748b;
            text-decoration: none;
            border-radius: 6px;
            transition: all 0.2s ease;
            font-size: 0.95rem;
            font-weight: 500;
        }

            .topbar nav .nav-link:hover {
                color: #2563eb;
                background: #f0f7ff;
            }

            .topbar nav .nav-link.active {
                color: #2563eb;
                background: #eff6ff;
                border-bottom: 3px solid #2563eb;
            }

        .topbar nav .nav-link svg {
            flex-shrink: 0;
        }

.topbar-end {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.user-name {
    color: #64748b;
    font-size: 0.9rem;
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

.row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.row {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
}

.muted {
    color: #64748b;
}

.error {
    color: #dc2626;
}

.back {
    display: inline-block;
    color: #64748b;
    font-size: .875rem;
    margin-bottom: .5rem;
    text-decoration: none;
}

    .back:hover {
        text-decoration: underline;
    }

.btn {
    display: inline-block;
    padding: .5rem .9rem;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
    text-decoration: none;
    cursor: pointer;
    font-size: .9rem;
}

    .btn:hover {
        background: #f1f5f9;
    }

    .btn.primary {
        background: #2563eb;
        color: #fff;
        border-color: #2563eb;
    }

        .btn.primary:hover {
            background: #1d4ed8;
        }

    .btn.danger {
        color: #dc2626;
    }

        .btn.danger:hover {
            background: #fee2e2;
        }

    .btn.small {
        padding: .25rem .5rem;
        font-size: .8rem;
    }

    .btn.btn-icon-edit {
        display: inline-flex;
        align-items: center;
        gap: .4rem;
        padding: .35rem .75rem;
        flex-shrink: 0;
    }

    @media (max-width: 480px) {
        .btn.btn-icon-edit .btn-edit-label {
            display: none;
        }

        .btn.btn-icon-edit {
            padding: .4rem .5rem;
        }
    }

    .btn.big {
        padding: 1rem 2rem;
        font-size: 1.25rem;
    }

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

.card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin-top: 1.5rem;
}

.card {
    display: block;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
}

    .card:hover {
        border-color: #2563eb;
    }

    .routine-page-layout {
        display: grid;
        grid-template-columns: 240px 1fr;
        gap: 1.5rem;
        align-items: start;
        margin-top: 1.5rem;
    }

    .routine-filter-sidebar {
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 1rem;
        position: sticky;
        top: 1rem;
    }

    .routine-filter-heading {
        margin: 0 0 0.75rem;
        font-size: 0.95rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #475569;
    }

    .routine-filter-list {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .routine-filter-btn {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0.5rem 0.65rem;
        border-radius: 8px;
        border: 1px solid #e2e8f0;
        background: #fff;
        color: #0f172a;
        text-align: left;
        cursor: pointer;
    }

    .routine-filter-btn:hover {
        border-color: #93c5fd;
        background: #f8fbff;
    }

    .routine-filter-btn.active {
        border-color: #2563eb;
        background: #eff6ff;
        color: #1d4ed8;
        font-weight: 600;
    }

    .routine-filter-count {
        font-size: 0.75rem;
        color: #64748b;
    }

/* Routine tiles - professional card layout */
.routine-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    margin-top: 2rem;
}

.routine-tile {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid #e2e8f0;
}

    .routine-tile:hover {
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        transform: translateY(-4px);
        border-color: #2563eb;
    }

.routine-tile-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

    .routine-tile-image img,
    .routine-tile-image video {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.routine-tile-image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.placeholder-icon {
    font-size: 3.5rem;
    opacity: 0.8;
}

.routine-tile-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.routine-tile-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
}

.routine-tile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.routine-tile-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

.meta-item {
    display: inline-block;
}

/* Exercise tiles - professional card layout */
.exercise-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    margin-top: 2rem;
}

.exercise-tile {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid #e2e8f0;
}

    .exercise-tile:hover {
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        transform: translateY(-4px);
        border-color: #2563eb;
    }

.exercise-tile-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

    .exercise-tile-image img,
    .exercise-tile-image video {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.exercise-tile-image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.exercise-tile-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-grow: 1;
}

.exercise-tile-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
}

.exercise-tile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 0.25rem 0.65rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.exercise-tile-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
    flex-wrap: wrap;
}

.list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.list-item {
    padding: .75rem 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: .5rem;
}

    .list-item a {
        text-decoration: none;
        color: inherit;
        display: block;
    }

    .list-item .title {
        font-weight: 600;
    }

    .list-item .meta {
        font-size: .85rem;
        color: #64748b;
        margin-top: .15rem;
    }

.search {
    display: block;
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 1rem;
    margin: 1rem 0;
}

.form {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

    .form label {
        display: flex;
        flex-direction: column;
        gap: .25rem;
        font-size: .9rem;
    }

    .form input, .form textarea, .form select {
        padding: .5rem .65rem;
        border: 1px solid #cbd5e1;
        border-radius: 6px;
        font-size: 1rem;
        background: #fff;
    }

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

.grid-2 {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr 1fr;
    margin-top: 1rem;
}

@media (max-width: 600px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .routine-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    .routine-page-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .routine-filter-sidebar {
        position: static;
    }

    .routine-filter-list {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .routine-filter-btn {
        width: auto;
        gap: 0.5rem;
    }

    .exercise-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

.stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    padding: .75rem 0;
    color: #475569;
}

.media-grid {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.media-item {
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

    .media-item video, .media-item img {
        width: 100%;
        display: block;
        aspect-ratio: 16/9;
        object-fit: contain;
    }

    .media-item .btn {
        position: absolute;
        bottom: .5rem;
        right: .5rem;
    }

.player {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    margin-top: 1rem;
}

    .player .timer {
        font-size: 4rem;
        font-weight: 700;
        margin: 1rem 0;
    }

.exercise-description {
    margin-top: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

    .exercise-description h3 {
        margin: 0 0 .5rem;
        font-size: .85rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: #475569;
    }

    .exercise-description p {
        margin: 0;
        color: #334155;
        line-height: 1.6;
    }

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: #fee2e2;
    border-top: 2px solid #dc2626;
}

    #blazor-error-ui.show {
        display: block;
    }

    #blazor-error-ui a {
        margin-left: 1rem;
    }
