:root {
    /* Primary accent - vibrant orange */
    --primary-color: #ff6b35;
    --primary-dark: #e85a28;
    --primary-glow: rgba(255, 107, 53, 0.3);

    /* Secondary colors */
    --secondary-color: #6366f1;
    --accent-color: #22d3ee;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;

    /* Dark theme backgrounds */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --bg-card-hover: #22222e;
    --bg-input: #0f0f14;
    --bg-elevated: #252530;

    /* Text colors */
    --text-primary: #f0f0f5;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-dark: #f0f0f5;
    --text-light: #f5f5f5;

    /* Borders */
    --border-color: #2a2a36;
    --border-light: #3a3a48;

    /* Legacy support */
    --bg-light: #1e1e28;

    /* Shadows & effects */
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(255, 107, 53, 0.15);
    --glass-bg: rgba(26, 26, 36, 0.8);
    --glass-border: rgba(255, 255, 255, 0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    color: var(--text-primary);
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(255, 107, 53, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 70%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 40% 30% at 50% 90%, rgba(34, 211, 238, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.auth-container {
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: var(--shadow), 0 0 0 1px var(--glass-border);
    max-width: 450px;
    width: 100%;
    overflow: hidden;
    animation: slideUp 0.5s ease-out;
    position: relative;
    z-index: 1;
    border: 1px solid var(--border-color);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.auth-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.fitness-icon {
    font-size: 48px;
    margin-bottom: 10px;
    display: inline-block;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.auth-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
    position: relative;
    z-index: 1;
}

.auth-header p {
    font-size: 14px;
    opacity: 0.95;
    position: relative;
    z-index: 1;
}

.auth-body {
    padding: 40px 30px;
    background: var(--bg-card);
}

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

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: var(--bg-input);
    color: var(--text-primary);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
    color: var(--text-muted);
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--primary-glow), var(--shadow-glow);
}

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

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    margin-top: 10px;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-light);
}

.error-message {
    background: rgba(239, 68, 68, 0.15);
    border-left: 4px solid var(--error-color);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.consent-scopes {
    margin: 25px 0;
}

.scope-item {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 12px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.scope-item:hover {
    border-color: var(--accent-color);
    background: var(--bg-elevated);
    transform: translateX(5px);
}

.scope-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.scope-label {
    flex: 1;
}

.scope-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
    display: block;
    margin-bottom: 4px;
}

.scope-description {
    color: var(--text-secondary);
    font-size: 13px;
}

.client-info {
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--accent-color);
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.client-info strong {
    color: var(--accent-color);
    font-size: 16px;
}

.auth-footer {
    text-align: center;
    padding: 20px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border-color);
}

.stats-bar {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    background: var(--bg-secondary);
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
    text-shadow: 0 0 20px var(--primary-glow);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 480px) {
    .auth-container {
        border-radius: 0;
    }

    .auth-header {
        padding: 30px 20px;
    }

    .auth-body {
        padding: 30px 20px;
    }

    .fitness-icon {
        font-size: 36px;
    }

    .auth-header h1 {
        font-size: 24px;
    }
}

/* ===========================
   PROFILES PAGE STYLES
   =========================== */

.profiles-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    min-height: 100vh;
    background: var(--bg-primary);
}

.profiles-panel {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
}

.panel-header {
    padding: 30px 20px 20px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    z-index: 10;
}

.panel-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: 700;
}

.panel-header p {
    font-size: 14px;
    opacity: 0.9;
}

.profiles-list {
    padding: 10px;
}

.profile-item {
    padding: 16px;
    margin-bottom: 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    text-decoration: none;
    color: var(--text-primary);
    display: block;
}

.profile-item:hover {
    background: var(--bg-card-hover);
    transform: translateX(5px);
    border-color: var(--border-light);
}

.profile-item.active {
    background: rgba(255, 107, 53, 0.1);
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px var(--primary-glow);
}

.profile-item-period {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.profile-item-dates {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.empty-state {
    padding: 60px 30px;
    text-align: center;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h2 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
}

.details-panel {
    overflow-y: auto;
    padding: 40px;
    background: var(--bg-primary);
}

.details-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-primary);
}

.details-empty-content {
    max-width: 400px;
}

.details-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.details-empty h2 {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.details-empty p {
    font-size: 16px;
    color: var(--text-secondary);
}

.details-content {
    max-width: 900px;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.details-header {
    margin-bottom: 40px;
}

.details-period {
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px var(--primary-glow);
}

.details-goal {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.4;
    white-space: pre-wrap;
}

.details-dates {
    font-size: 15px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.photos-section {
    margin-bottom: 50px;
}

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

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.upload-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--primary-glow);
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.photo-item {
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    position: relative;
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

.photo-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-photos {
    padding: 60px 20px;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 2px dashed var(--border-light);
}

.no-photos-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.no-photos p {
    color: var(--text-secondary);
    font-size: 14px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-hover);
    animation: slideUp 0.3s ease-out;
    border: 1px solid var(--border-color);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 24px;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 24px;
    background: var(--bg-card);
}

.upload-area {
    border: 3px dashed var(--border-light);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg-secondary);
    margin-bottom: 20px;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(255, 107, 53, 0.1);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(255, 107, 53, 0.15);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.upload-area p {
    color: var(--text-secondary);
    font-size: 14px;
}

.upload-area .primary-text {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: 4px;
}

input[type="file"] {
    display: none;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.preview-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.8);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    color: var(--error-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.preview-item .remove-btn:hover {
    background: var(--error-color);
    color: white;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--primary-glow);
}

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

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-left: 4px solid var(--error-color);
}

@media (max-width: 1024px) {
    .profiles-container {
        grid-template-columns: 1fr;
    }

    .profiles-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 40vh;
    }

    .details-panel {
        padding: 20px;
    }
}

@media (max-width: 640px) {
    .panel-header {
        padding: 20px 16px 16px;
    }

    .panel-header h1 {
        font-size: 20px;
    }

    .details-panel {
        padding: 20px 16px;
    }

    .details-content {
        padding: 30px 20px;
    }

    .details-goal {
        font-size: 20px;
    }

    .photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .modal-content {
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }
}