/* ============================================
   הפרימריה — אימונים כדרך חיים
   Gym Training Tracker Styles
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --gradient-primary: linear-gradient(135deg, #FF6B35, #E63946);
    --gradient-card: linear-gradient(135deg, #FF6B35, #FF8C42);
    --color-orange: #FF6B35;
    --color-red: #E63946;
    --color-warm: #FF8C42;
    --bg-dark: #0F0F23;
    --bg-card: rgba(255, 255, 255, 0.06);
    --bg-card-hover: rgba(255, 255, 255, 0.1);
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.65);
    --text-muted: rgba(255, 255, 255, 0.4);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --spacing: 16px;
    --font: 'Heebo', sans-serif;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    overflow-x: hidden;
}

/* --- Views --- */
.view {
    display: none;
    min-height: 100vh;
}

.view.active {
    display: block;
    animation: viewFadeIn 0.3s ease;
}

@keyframes viewFadeIn {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* --- Header --- */
.header {
    background: var(--gradient-primary);
    padding: 20px var(--spacing);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(230, 57, 70, 0.4);
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    display: flex;
    align-items: center;
}

.logo-icon .logo-img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    line-height: 1.1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.logo-text p {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.9;
    letter-spacing: 0.5px;
}

.btn-new-workout {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-new-workout:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.btn-new-workout .btn-icon {
    font-size: 1.1rem;
    font-weight: 900;
}

/* --- Workout Page Header --- */
.header-workout .header-content {
    justify-content: space-between;
}

.header-workout-title {
    font-size: 1.15rem;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    flex: 1;
    text-align: center;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-back span {
    font-size: 1.1rem;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.25);
}

.btn-delete-workout {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    font-size: 1.1rem;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete-workout:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* --- Main --- */
.main {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--spacing);
    padding-bottom: 100px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* --- Sections --- */
.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon {
    font-size: 1.3rem;
}

/* --- Stats Section --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 16px 10px;
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    background: var(--gradient-primary);
}

.stat-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 1.6rem;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 600;
}

/* --- Workout List (Home) --- */
.workout-list-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 18px 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.workout-list-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient-primary);
}

.workout-list-card:hover {
    background: var(--bg-card-hover);
    transform: translateX(-4px);
}

.workout-list-card:active {
    transform: scale(0.98);
}

.workout-list-info {
    padding-right: 8px;
}

.workout-list-name {
    font-size: 1.05rem;
    font-weight: 700;
}

.workout-list-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.workout-list-arrow {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.workout-list-card:hover .workout-list-arrow {
    color: var(--color-orange);
}

/* --- Exercise Cards (Workout Page) --- */
.exercise-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    overflow: hidden;
    position: relative;
    transition: all 0.2s ease;
}

.exercise-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient-primary);
}

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

.exercise-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.exercise-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.exercise-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.exercise-toggle-icon {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
}

.exercise-card.expanded .exercise-toggle-icon {
    transform: rotate(-90deg);
}

.exercise-name {
    font-size: 1.05rem;
    font-weight: 700;
}

.exercise-summary {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.exercise-card.expanded .exercise-summary {
    display: none;
}

.exercise-actions {
    display: flex;
    gap: 4px;
}

/* --- Exercise Body (collapsible) --- */
.exercise-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.exercise-card.expanded .exercise-body {
    max-height: 600px;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
    opacity: 0.6;
}

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

/* --- Sets Table --- */
.sets-table {
    width: 100%;
    border-collapse: collapse;
}

.sets-table thead {
    background: rgba(255, 255, 255, 0.04);
}

.sets-table th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sets-table td {
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.sets-table tbody tr:last-child td {
    border-bottom: none;
}

.sets-table tbody tr {
    transition: background 0.15s;
}

.sets-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* --- Set Inputs --- */
.set-input {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    width: 60px;
    padding: 6px 4px;
    outline: none;
    transition: border-color 0.2s;
    -moz-appearance: textfield;
}

.set-input::-webkit-outer-spin-button,
.set-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.set-input::placeholder {
    color: var(--text-muted);
}

.set-input:focus {
    border-color: var(--color-orange);
    background: rgba(255, 107, 53, 0.06);
}

.btn-delete-set {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-delete-set:hover {
    color: var(--color-red);
    background: rgba(230, 57, 70, 0.15);
}

.btn-add-set {
    width: 100%;
    background: none;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--color-orange);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-set:hover {
    background: rgba(255, 107, 53, 0.1);
}

.btn-add-exercise {
    width: 100%;
    background: var(--bg-card);
    border: 2px dashed rgba(255, 107, 53, 0.4);
    color: var(--color-orange);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-exercise:hover {
    background: rgba(255, 107, 53, 0.1);
    border-color: var(--color-orange);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-secondary);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 1rem;
    font-weight: 600;
}

.empty-state .empty-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.empty-state.hidden {
    display: none;
}

/* --- Calendar Section --- */
.calendar {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 16px;
    overflow: hidden;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.calendar-month {
    font-size: 1.1rem;
    font-weight: 700;
}

.calendar-nav {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-nav:hover {
    background: rgba(255, 107, 53, 0.2);
    color: var(--color-orange);
}

.calendar-days-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 8px;
}

.calendar-days-header span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 6px 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    position: relative;
    cursor: default;
    transition: all 0.15s;
}

.calendar-day.today {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    font-weight: 700;
}

.calendar-day.has-workout {
    color: var(--text-primary);
    cursor: pointer;
}

.calendar-day.has-workout::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gradient-primary);
}

.calendar-day.has-workout:hover {
    background: rgba(255, 107, 53, 0.15);
}

.calendar-day.empty {
    visibility: hidden;
}

.calendar-day.other-month {
    color: var(--text-muted);
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #1E1E36;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    width: 100%;
    max-width: 380px;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.25s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.modal-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 18px;
}

.modal-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    padding: 14px 16px;
    outline: none;
    transition: border-color 0.2s;
}

.modal-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.modal-input:focus {
    border-color: var(--color-orange);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.modal-btn {
    flex: 1;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

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

.modal-btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 107, 53, 0.4);
}

.modal-btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.modal-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.14);
    color: var(--text-primary);
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 24px var(--spacing);
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    max-width: 600px;
    margin: 0 auto;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.section {
    animation: fadeInUp 0.5s ease both;
}

.stats-section { animation-delay: 0.1s; }
.calendar-section { animation-delay: 0.2s; }

.exercise-card {
    animation: fadeInUp 0.4s ease both;
}

/* --- Responsive --- */
@media (max-width: 400px) {
    .header-content {
        flex-wrap: wrap;
        gap: 10px;
    }

    .btn-new-workout {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .stat-card {
        padding: 12px 6px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }
}

@media (min-width: 768px) {
    .main {
        padding: 24px;
        gap: 32px;
    }

    .header {
        padding: 24px 32px;
    }

    .header-content,
    .main {
        max-width: 700px;
    }

    .stats-grid {
        gap: 16px;
    }

    .stat-card {
        padding: 20px 16px;
    }

    .stat-value {
        font-size: 1.8rem;
    }

    .calendar {
        padding: 24px;
    }

    .calendar-day {
        font-size: 0.95rem;
    }

    .footer {
        max-width: 700px;
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* --- Selection --- */
::selection {
    background: rgba(255, 107, 53, 0.3);
    color: white;
}
