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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* Navigation */
.nav {
    display: flex;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.nav-link {
    text-decoration: none;
    color: #666;
    font-size: 15px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: #333;
    background-color: #f5f5f5;
}

.nav-link.active {
    color: #ff6b35;
    background-color: #fff3ef;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.user-menu-trigger:hover {
    background-color: #f5f5f5;
}

.user-icon {
    width: 32px;
    height: 32px;
    background-color: #4caf50;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.username {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.dropdown-icon {
    color: #666;
    transition: transform 0.2s ease;
}

.user-menu-trigger:hover .dropdown-icon {
    transform: translateY(2px);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
}

.dropdown-item svg {
    flex-shrink: 0;
}

.dropdown-item-danger {
    color: #dc3545;
}

.dropdown-item-danger:hover {
    background-color: #fee;
}

.dropdown-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 8px 0;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 80px);
}

/* Dark Theme */
body[data-theme="dark"] {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body[data-theme="dark"] .header {
    background-color: #2d2d2d;
    border-bottom-color: #404040;
}

body[data-theme="dark"] .logo {
    color: #e0e0e0;
}

body[data-theme="dark"] .nav-link {
    color: #b0b0b0;
}

body[data-theme="dark"] .nav-link:hover {
    color: #e0e0e0;
    background-color: #3d3d3d;
}

body[data-theme="dark"] .nav-link.active {
    color: #ff8c5a;
    background-color: #3d2d27;
}

body[data-theme="dark"] .user-menu-trigger:hover {
    background-color: #3d3d3d;
}

body[data-theme="dark"] .username {
    color: #e0e0e0;
}

body[data-theme="dark"] .dropdown-icon {
    color: #b0b0b0;
}

body[data-theme="dark"] .user-dropdown {
    background-color: #2d2d2d;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

body[data-theme="dark"] .dropdown-item {
    color: #e0e0e0;
}

body[data-theme="dark"] .dropdown-item:hover {
    background-color: #3d3d3d;
}

body[data-theme="dark"] .dropdown-item-danger {
    color: #ff6b6b;
}

body[data-theme="dark"] .dropdown-item-danger:hover {
    background-color: #3d2d2d;
}

body[data-theme="dark"] .dropdown-divider {
    background-color: #404040;
}

/* Page Layout */
.content-wrapper {
    padding: 40px 0;
}

/* Page Header */
.page-header {
    margin-bottom: 40px;
}

.page-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 32px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #ff6b35;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background-color: #e85a28;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #f5f5f5;
    color: #333;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

.btn-cancel {
    color: #666;
    text-decoration: none;
    padding: 8px 16px;
    transition: color 0.2s ease;
}

.btn-cancel:hover {
    color: #333;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-icon:hover {
    background-color: #f5f5f5;
    color: #333;
}

.btn-delete:hover {
    background-color: #fee;
    color: #dc3545;
}

/* Forms */
.form-card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: #ff6b35;
}

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

.form-help {
    display: block;
    font-size: 13px;
    color: #999;
    margin-top: 6px;
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-top: 8px;
}

.form-errors {
    color: #dc3545;
    font-size: 13px;
    margin-top: 4px;
}

/* Alerts */
.alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state-icon {
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-state-icon svg {
    display: inline-block;
}

.empty-state-title {
    font-size: 24px;
    font-weight: 600;
    color: #666;
    margin-bottom: 12px;
}

.empty-state-text {
    font-size: 16px;
    color: #999;
    max-width: 500px;
    margin: 0 auto;
}

/* Dark Theme - Page Elements */
body[data-theme="dark"] .content-wrapper {
    background-color: #1a1a1a;
}

body[data-theme="dark"] .page-title {
    color: #e0e0e0;
}

body[data-theme="dark"] .page-subtitle {
    color: #b0b0b0;
}

body[data-theme="dark"] .btn-secondary {
    background-color: #3d3d3d;
    color: #e0e0e0;
}

body[data-theme="dark"] .btn-secondary:hover {
    background-color: #4d4d4d;
}

body[data-theme="dark"] .btn-cancel {
    color: #b0b0b0;
}

body[data-theme="dark"] .btn-cancel:hover {
    color: #e0e0e0;
}

body[data-theme="dark"] .btn-icon {
    color: #b0b0b0;
}

body[data-theme="dark"] .btn-icon:hover {
    background-color: #3d3d3d;
    color: #e0e0e0;
}

body[data-theme="dark"] .btn-delete:hover {
    background-color: #3d2d2d;
    color: #ff6b6b;
}

body[data-theme="dark"] .form-card {
    background-color: #2d2d2d;
}

body[data-theme="dark"] .form-group label {
    color: #e0e0e0;
}

body[data-theme="dark"] .form-input,
body[data-theme="dark"] .form-textarea,
body[data-theme="dark"] .form-select {
    background-color: #1a1a1a;
    border-color: #404040;
    color: #e0e0e0;
}

body[data-theme="dark"] .form-input:focus,
body[data-theme="dark"] .form-textarea:focus,
body[data-theme="dark"] .form-select:focus {
    border-color: #ff8c5a;
}

body[data-theme="dark"] .form-help {
    color: #808080;
}

body[data-theme="dark"] .alert-success {
    background-color: #1e3a1e;
    color: #7fd87f;
    border-color: #2d5a2d;
}

body[data-theme="dark"] .empty-state-title {
    color: #b0b0b0;
}

body[data-theme="dark"] .empty-state-text {
    color: #808080;
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 16px;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: #ff6b35;
}

/* Form Sections */
.exercise-form,
.routine-form {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-row .full-width {
    grid-column: 1 / -1;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

/* Form Controls */
.form-control {
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    color: #333;
    background-color: #fff;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-control::placeholder {
    color: #999;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
}

/* Input with Button */
.input-with-button {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.input-with-button .form-control {
    flex: 1;
}

.btn-add-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #ff6b35;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-add-inline:hover {
    background-color: #e55a2b;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.btn-add-inline svg {
    width: 16px;
    height: 16px;
}

/* Dark Theme - Form Elements */
body[data-theme="dark"] .back-link {
    color: #b0b0b0;
}

body[data-theme="dark"] .back-link:hover {
    color: #ff8c5a;
}

body[data-theme="dark"] .form-section-title {
    color: #e0e0e0;
    border-bottom-color: #404040;
}

body[data-theme="dark"] .form-control {
    background-color: #1a1a1a;
    border-color: #404040;
    color: #e0e0e0;
}

body[data-theme="dark"] .form-control:focus {
    border-color: #ff8c5a;
    box-shadow: 0 0 0 3px rgba(255, 140, 90, 0.1);
}

body[data-theme="dark"] .form-control::placeholder {
    color: #666;
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ============================================ */

/* Tablet and below (768px) */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }

    /* Header responsive */
    .header-content {
        flex-direction: column;
        gap: 12px;
        padding: 12px 0;
    }

    .logo {
        font-size: 18px;
    }

    /* Navigation responsive */
    .nav {
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 4px;
    }

    .nav::-webkit-scrollbar {
        display: none;
    }

    .nav-link {
        white-space: nowrap;
        font-size: 14px;
        padding: 6px 12px;
        flex-shrink: 0;
    }

    /* Content wrapper */
    .content-wrapper {
        padding: 20px 0;
    }

    /* Page header */
    .page-header-simple {
        margin-bottom: 20px;
    }

    .page-title {
        font-size: 24px;
    }

    /* Cards */
    .form-card,
    .training-days-container {
        padding: 16px;
        border-radius: 8px;
    }

    /* Training day cards */
    .training-day-card {
        padding: 12px;
    }

    .training-day-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .training-day-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Buttons */
    .btn-primary,
    .btn-secondary {
        padding: 10px 20px;
        font-size: 14px;
    }

    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Form inputs */
    .form-input,
    .form-textarea,
    .form-select {
        font-size: 16px;
        /* Prevent zoom on iOS */
    }

    /* Actions row */
    .actions-row {
        flex-direction: column;
        gap: 12px;
    }

    .actions-row .btn-add {
        width: 100%;
    }

    /* Stats grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* List items */
    .list-item {
        padding: 12px;
    }

    .list-item-content h3 {
        font-size: 16px;
    }

    .list-item-meta {
        font-size: 13px;
        flex-direction: column;
        gap: 4px;
    }
}

/* Mobile phones (480px and below) */
@media (max-width: 480px) {
    .container {
        padding: 0 8px;
    }

    .header-content {
        padding: 8px 0;
    }

    .page-title {
        font-size: 20px;
    }

    .form-card,
    .training-days-container {
        padding: 12px;
    }

    .training-day-card {
        padding: 10px;
    }

    .btn-primary,
    .btn-secondary {
        padding: 8px 16px;
        font-size: 13px;
    }
}