/* RunPlan - Sportivex Inspired Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* === Background === */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #161622;
    --bg-card-hover: #1c1c2e;
    --bg-input: #0e0e18;
    /* === Borders === */
    --border-color: #1f1f30;
    --border-focus: #a3e635;
    /* === Text === */
    --text-primary: #f0f0f5;
    --text-secondary: #9a9ab0;
    --text-muted: #5a5a72;
    /* === Accent: Neon Lime Green === */
    --accent: #a3e635;
    --accent-light: #bef264;
    --accent-dark: #84cc16;
    --accent-glow: rgba(163, 230, 53, 0.12);
    --accent-glow-strong: rgba(163, 230, 53, 0.25);
    /* === Secondary Colors === */
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --purple: #8b5cf6;
    --pink: #ec4899;
    --orange: #f97316;
    /* === Shadows === */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(163, 230, 53, 0.08);
    --shadow-neon: 0 0 30px rgba(163, 230, 53, 0.15), 0 0 60px rgba(163, 230, 53, 0.05);
    /* === Radius (rounder like Sportivex) === */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 22px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    background: var(--bg-primary);
}

/* ========================
   NAVIGATION
======================== */
.navbar {
    background: rgba(18, 18, 26, 0.85);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.navbar-brand .logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.navbar-brand .logo-icon {
    font-size: 1.5rem;
}

.navbar-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ========================
   LAYOUT
======================== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.container-wide {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ========================
   PAGE HEADER
======================== */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ========================
   CARDS
======================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(163, 230, 53, 0.25);
    box-shadow: var(--shadow-neon);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header .icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.card-header .icon.green {
    background: rgba(163, 230, 53, 0.12);
    color: var(--accent);
}

.card-header .icon.blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.card-header .icon.purple {
    background: rgba(139, 92, 246, 0.15);
    color: var(--purple);
}

.card-header .icon.orange {
    background: rgba(249, 115, 22, 0.15);
    color: var(--orange);
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ========================
   FORM ELEMENTS
======================== */
.form-group {
    margin-bottom: 1.25rem;
}

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

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

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Days Selector */
.days-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.day-checkbox {
    position: relative;
}

.day-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.day-checkbox .day-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.day-checkbox .day-label:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.day-checkbox input[type="checkbox"]:checked+.day-label {
    background: var(--accent);
    border-color: var(--accent);
    color: #0a0a0f;
    font-weight: 700;
    box-shadow: 0 0 16px rgba(163, 230, 53, 0.45);
}

/* Weeks indicator */
.weeks-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--accent-glow);
    border: 1px solid rgba(163, 230, 53, 0.2);
    border-radius: var(--radius-md);
    margin-top: 1rem;
    animation: fadeIn 0.5s ease;
}

.weeks-indicator .weeks-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

.weeks-indicator .weeks-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.weeks-indicator .weeks-text strong {
    color: var(--accent-light);
}

/* ========================
   BUTTONS
======================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #0a0a0f;
    font-weight: 700;
    box-shadow: 0 4px 18px rgba(163, 230, 53, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(163, 230, 53, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* ========================
   CALENDAR VIEW
======================== */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.calendar-nav button {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 1.2rem;
}

.calendar-nav button:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.calendar-month-label {
    font-size: 1.3rem;
    font-weight: 700;
    min-width: 200px;
    text-align: center;
}

/* Plan info bar */
.plan-info-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.plan-stat {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    transition: var(--transition);
}

.plan-stat:hover {
    border-color: rgba(163, 230, 53, 0.25);
    box-shadow: var(--shadow-glow);
}

.plan-stat .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
}

.plan-stat .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.calendar-day-header {
    background: var(--bg-secondary);
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.calendar-day {
    background: var(--bg-primary);
    min-height: 100px;
    padding: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.calendar-day:hover {
    background: var(--bg-card-hover);
}

.calendar-day.empty {
    background: rgba(10, 10, 15, 0.5);
    cursor: default;
}

.calendar-day.today {
    border: 2px solid var(--accent);
    background: var(--accent-glow);
}

.calendar-day.rest-day {
    opacity: 0.7;
}

.calendar-day .day-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.calendar-day.today .day-number {
    color: var(--accent);
}

.calendar-day .workout-badge {
    display: block;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-align: center;
    margin-top: 0.25rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-rodaje {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.badge-intervalos {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.badge-fartlek {
    background: rgba(249, 115, 22, 0.2);
    color: #fb923c;
}

.badge-tempo {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

.badge-larga {
    background: rgba(163, 230, 53, 0.15);
    color: #bef264;
}

.badge-fuerza {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
}

.badge-descanso {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
}

.badge-competicion {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.badge-cuestas {
    background: rgba(234, 88, 12, 0.2);
    color: #fb923c;
}

.badge-recuperacion {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
}

.calendar-day .week-phase {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    text-align: center;
}

/* ========================
   WORKOUT DETAIL MODAL
======================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-header .modal-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition);
    line-height: 1;
}

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

.modal-body {
    padding: 1.75rem;
}

.modal-section {
    margin-bottom: 1.5rem;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-section p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
}

.modal-section .highlight-box {
    background: var(--bg-input);
    border-left: 3px solid var(--accent);
    padding: 1rem 1.25rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-top: 0.5rem;
}

.modal-section .highlight-box.warning {
    border-left-color: var(--warning);
}

.modal-section .highlight-box.info {
    border-left-color: var(--info);
}

.modal-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.modal-metric {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    text-align: center;
}

.modal-metric .metric-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}

.modal-metric .metric-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* ========================
   LEGEND
======================== */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* ========================
   ALERTS
======================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

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

.alert-success {
    background: rgba(163, 230, 53, 0.08);
    border: 1px solid rgba(163, 230, 53, 0.25);
    color: var(--accent-light);
}

/* ========================
   PHASE INDICATOR
======================== */
.phase-bar {
    display: flex;
    border-radius: var(--radius-md);
    overflow: hidden;
    height: 8px;
    margin-bottom: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.phase-segment {
    height: 100%;
    transition: var(--transition);
}

.phase-base {
    background: var(--info);
}

.phase-build {
    background: var(--orange);
}

.phase-peak {
    background: var(--danger);
}

.phase-taper {
    background: var(--accent);
}

.phase-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ========================
   BACK LINK
======================== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--accent);
}

/* ========================
   ANIMATIONS
======================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

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

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* ========================
   RESPONSIVE
======================== */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

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

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

    .page-header h1 {
        font-size: 1.5rem;
    }

    .card {
        padding: 1.25rem;
    }

    .navbar {
        padding: 0 1rem;
    }

    .calendar-grid {
        font-size: 0.8rem;
    }

    .calendar-day {
        min-height: 70px;
        padding: 0.35rem;
    }

    .calendar-day .workout-badge {
        font-size: 0.55rem;
        padding: 0.15rem 0.25rem;
    }

    .plan-info-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal {
        max-height: 95vh;
        margin: 0.5rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn-block-mobile {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .days-selector {
        justify-content: center;
    }

    .day-checkbox .day-label {
        width: 40px;
        height: 40px;
        font-size: 0.75rem;
    }

    .plan-info-bar {
        grid-template-columns: 1fr 1fr;
    }

    .calendar-day-header {
        font-size: 0.6rem;
        padding: 0.5rem 0.25rem;
    }
}

/* ========================
   LOADING SPINNER
======================== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    z-index: 2000;
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay .spinner-lg {
    width: 48px;
    height: 48px;
    border-width: 3px;
}

.loading-overlay p {
    color: var(--text-secondary);
    font-size: 1rem;
}