/* --- Global Styles & Variables --- */
:root {
    --primary-color: #e50914;
    --dark-color: #121212;
    --dark-grey: #1e1e1e;
    --light-grey: #2c2c2c;
    --text-color: #f5f5f5;
    --text-muted: #a0a0a0;
    --font-family-arabic: 'Cairo', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-family-arabic);
    background-color: var(--dark-color);
    color: var(--text-color);
    line-height: 1.7;
    direction: rtl;
    text-align: right;
    -webkit-tap-highlight-color: transparent;
}

.container { max-width: 1200px; margin: auto; padding: 0 15px; }

h1, h2, h3, h4 { font-weight: 700; line-height: 1.3; }
h1 { font-size: 2.5rem; }
h2 { font-size: 1.8rem; margin-bottom: 25px; border-right: 4px solid var(--primary-color); padding-right: 15px; }
h3 { font-size: 1.5rem; margin-bottom: 20px; }
h4 { font-size: 1.2rem; }

a { color: var(--primary-color); text-decoration: none; transition: color 0.3s ease; }
a:hover { color: #ff4d4d; }

.card {
    background: var(--dark-grey);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    border: 1px solid #2a2a2a;
}

/* --- Header --- */
header {
    background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url(https://images.unsplash.com/photo-1571019613454-1cb2f99b2d8b?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80) no-repeat center center/cover;
    padding: 40px 0;
    text-align: center;
    border-bottom: 6px solid var(--primary-color);
}
.macros { display: flex; justify-content: center; gap: 15px; margin-top: 30px; flex-wrap: wrap; }
.macro-item { background: rgba(30, 30, 30, 0.8); backdrop-filter: blur(5px); padding: 15px 20px; border-radius: 10px; text-align: center; min-width: 110px; }
.macro-item .value { font-size: 2rem; font-weight: 700; color: var(--primary-color); display: block; }
.macro-item .label { font-size: 0.9rem; color: var(--text-muted); margin-top: 5px; }

/* --- Schedule --- */
.schedule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.day-card { background: var(--light-grey); padding: 15px; text-align: center; border-radius: 10px; color: var(--text-color); transition: transform 0.3s ease, background 0.3s ease; font-size: 1rem; font-weight: 600; cursor: pointer; }
.day-card:hover { transform: translateY(-5px); background: var(--primary-color); color: #fff; }
.day-card.rest-day { background: #282828; color: #888; cursor: default; }
.day-card.rest-day:hover { transform: none; background: #282828; }
.day-card strong { display: block; font-size: 0.9rem; color: var(--text-muted); }

/* --- Warmup Section --- */
.warmup-content { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.video-container { flex: 1; min-width: 280px; }
.video-container iframe { width: 100%; aspect-ratio: 16/9; border-radius: 10px; border: 2px solid var(--light-grey); }
.warmup-instructions { flex: 1; min-width: 280px; }
.warmup-instructions ul { list-style: none; padding-right: 0; }
.warmup-instructions li { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; color: var(--text-muted); font-size: 0.95rem; }
.warmup-instructions li i { color: var(--primary-color); margin-top: 5px; }

/* --- Workouts Tabs --- */
.tabs { display: flex; overflow-x: auto; gap: 10px; margin-bottom: 25px; padding-bottom: 10px; scrollbar-width: thin; scrollbar-color: var(--light-grey) var(--dark-grey); }
.tabs::-webkit-scrollbar { height: 5px; }
.tabs::-webkit-scrollbar-thumb { background: var(--light-grey); border-radius: 10px; }
.tab-link { padding: 10px 15px; cursor: pointer; background: var(--light-grey); border: none; color: var(--text-color); border-radius: 8px; font-size: 0.95rem; font-family: var(--font-family-arabic); font-weight: 600; transition: background 0.3s, color 0.3s; white-space: nowrap; }
.tab-link.active { background-color: var(--primary-color); color: #fff; }
.tab-content { display: none; animation: fadeIn 0.6s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- Exercise Cards & Video --- */
.exercise-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.exercise-card { background: var(--light-grey); padding: 20px; border-radius: 10px; border-top: 4px solid var(--primary-color); }
.exercise-card h4 { display: flex; align-items: center; gap: 10px; }
.exercise-card h4 .fas { color: var(--primary-color); font-size: 1.4rem; }
.exercise-card ul { padding-right: 0; list-style: none; margin: 15px 0; }
.exercise-card ul li { padding: 8px 0; border-bottom: 1px dashed #444; font-size: 0.9rem; display: flex; align-items: center; gap: 10px; color: var(--text-muted); }
.exercise-card ul li:last-of-type { border-bottom: none; }
.exercise-card ul li strong { color: var(--text-color); }

.toggle-video-btn { width: 100%; padding: 10px; font-family: var(--font-family-arabic); background-color: #333; color: var(--text-color); border: 1px solid #444; border-radius: 8px; cursor: pointer; font-size: 1rem; font-weight: 600; transition: background-color 0.3s; margin-bottom: 15px; }
.toggle-video-btn:hover { background-color: #444; }
.toggle-video-btn .fab { color: #ff0000; margin-left: 8px; }

.video-embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; background: #000; border-radius: 8px; margin-bottom: 15px; }
.video-embed-container iframe { position: absolute; top: 0; right: 0; width: 100%; height: 100%; }

.weight-tracker { border-top: 1px solid #444; padding-top: 15px; }
.weight-tracker label { font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 8px; font-size: 0.9rem; }
.input-group { display: flex; gap: 10px; }
.weight-input { flex-grow: 1; padding: 10px; border-radius: 5px; border: 1px solid #555; background-color: #333; color: var(--text-color); font-size: 1rem; text-align: center; }
.save-weight, .view-history { padding: 10px; background-color: var(--primary-color); color: #fff; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.3s; font-size: 1rem; }
.view-history { background-color: #555; }
input[type="number"] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Workout Notes inside Tabs */
.workout-notes { margin-top: 30px; border-top: 2px solid var(--light-grey); padding-top: 25px; }
.workout-notes textarea { width: 100%; min-height: 120px; background: var(--light-grey); border: 1px solid #444; border-radius: 8px; padding: 15px; color: var(--text-color); font-family: var(--font-family-arabic); font-size: 1rem; resize: vertical; margin-bottom: 15px; }
.workout-notes .save-notes { display: block; margin-right: auto; padding: 10px 20px; background-color: var(--primary-color); color: #fff; border: none; border-radius: 8px; cursor: pointer; transition: background-color 0.3s; font-weight: 600; }

/* --- Forearms Section --- */
#forearms-section { border-top: 4px solid var(--primary-color); }
.forearm-content { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.forearm-videos { flex: 2; display: grid; grid-template-columns: 1fr; gap: 20px; min-width: 280px; }
.video-player-forearm video { width: 100%; border-radius: 10px; border: 2px solid var(--light-grey); }
.forearm-tips { flex: 1; min-width: 280px; background: var(--light-grey); padding: 20px; border-radius: 10px; }
.forearm-tips ul { padding-right: 0; list-style: none; }
.forearm-tips li { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; color: var(--text-muted); font-size: 0.95rem; }
.forearm-tips li i { color: var(--primary-color); margin-top: 5px; }

/* --- Nutrition & Supplements --- */
.nutrition-container { display: flex; flex-wrap: wrap; gap: 20px; }
.meal-plan { flex: 2; min-width: 280px; }
.supplements { flex: 1; min-width: 280px; background: var(--light-grey); padding: 20px; border-radius: 10px; }
.meal-card { background: var(--light-grey); padding: 20px; border-radius: 8px; margin-bottom: 15px; }
.meal-card h4, .supplements h3 { color: var(--primary-color); margin-bottom: 10px; }
.supplements ul { padding-right: 0; list-style: none; }
.supplements li { padding: 10px 0; border-bottom: 1px dashed #444; font-size: 0.9rem; }
.supplements li:last-child { border-bottom: none; }

/* --- Modal --- */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.8); backdrop-filter: blur(5px); }
.modal-content { background-color: var(--dark-grey); margin: 15% auto; padding: 25px; border: 1px solid #333; width: 90%; max-width: 500px; border-radius: 10px; position: relative; animation: slideIn 0.4s ease-out; }
@keyframes slideIn { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.close-button { color: #aaa; position: absolute; left: 15px; top: 10px; font-size: 28px; font-weight: bold; cursor: pointer; }
#modal-body table { width: 100%; border-collapse: collapse; margin-top: 20px; }
#modal-body th, #modal-body td { padding: 10px; text-align: right; border-bottom: 1px solid var(--light-grey); }
#modal-body th { background-color: var(--primary-color); color: #fff; font-size: 0.95rem; }
#modal-body td { color: var(--text-muted); font-size: 0.9rem; }
#modal-body tr:last-child td { border-bottom: none; }
#modal-body p { color: var(--text-muted); }

/* --- Footer --- */
footer { text-align: center; padding: 30px; margin-top: 20px; color: #777; font-size: 1.2rem; font-weight: bold; background: #111; border-top: 5px solid var(--primary-color); }

/* --- Responsive Media Queries --- */
@media (min-width: 768px) {
    .exercise-grid { grid-template-columns: repeat(2, 1fr); }
    .forearm-videos { grid-template-columns: repeat(2, 1fr); }
    h1 { font-size: 2.8rem; }
    h2 { font-size: 2.2rem; }
    h3 { font-size: 1.6rem; }
    h4 { font-size: 1.3rem; }
}

@media (max-width: 480px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    .card { padding: 20px; }
    .day-card { font-size: 0.9rem; padding: 10px; }
    .macro-item { min-width: 100px; padding: 10px 15px; }
    .macro-item .value { font-size: 1.8rem; }
    .macro-item .label { font-size: 0.8rem; }
}
