/* ElegancyFit Portal - Professional Black/White/Orange Theme */

:root {
    /* ElegancyFit Brand Colors */
    --primary-orange: #ee942a;
    --primary-orange-dark: #d67d1e;
    --primary-orange-light: #f5a847;

    /* Neutrals - Black & White */
    --black: #1a1a1a;
    --gray-dark: #2b2b2b;
    --gray-medium: #666666;
    --gray-light: #e0e0e0;
    --gray-lighter: #f5f5f5;
    --white: #ffffff;

    /* Semantic colors */
    --text-primary: var(--black);
    --text-secondary: var(--gray-medium);
    --border: var(--gray-light);
    --bg-primary: var(--white);
    --bg-secondary: var(--gray-lighter);
    --success: #28a745;
    --error: #dc3545;

    /* Shadows - subtle and professional */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);

    /* Spacing */
    --radius: 8px;
}

* {
    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-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Login Container */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--gray-lighter) 0%, var(--gray-light) 100%);
}

.login-box {
    background: var(--white);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 450px;
    width: 100%;
    border: 1px solid var(--border);
}

.logo {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo h1 {
    font-size: 2.25rem;
    color: var(--black);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.back-to-site-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    margin-top: 0.5rem;
}

.back-to-site-login:hover {
    color: var(--primary-orange);
    background: var(--gray-lighter);
}

.back-to-site-login svg {
    width: 14px;
    height: 14px;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: var(--white);
    color: var(--text-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(238, 148, 42, 0.1);
}

.form-group input:disabled,
.form-group input[readonly] {
    background: var(--gray-lighter);
    cursor: not-allowed;
    color: var(--text-secondary);
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-small,
.btn-edit,
.btn-delete,
.btn-warning,
.btn-icon {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    line-height: 1;
}

/* Icon styling */
.btn-primary svg,
.btn-secondary svg,
.btn-edit svg,
.btn-delete svg,
.btn-warning svg,
.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--primary-orange);
    color: var(--white);
    width: 100%;
    box-shadow: var(--shadow-sm);
}

#createClientBtn {
    width: auto;
    min-width: 140px;
    padding: 0.75rem 1.25rem;
}

.btn-primary:hover {
    background: var(--primary-orange-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-dark);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--black);
    transform: translateY(-1px);
}

.btn-small {
    padding: 0.5rem 0.875rem;
    font-size: 0.8rem;
}

.btn-edit {
    background: var(--gray-dark);
    color: var(--white);
    padding: 0.5rem 0.875rem;
}

.btn-edit:hover {
    background: var(--black);
}

.btn-delete {
    background: var(--error);
    color: var(--white);
    padding: 0.5rem 0.875rem;
}

.btn-delete:hover {
    background: #c82333;
}

.btn-warning {
    background: var(--primary-orange);
    color: var(--white);
    padding: 0.5rem 0.875rem;
}

.btn-warning:hover {
    background: var(--primary-orange-dark);
}

.btn-icon {
    padding: 0.625rem;
    background: var(--gray-lighter);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-icon:hover {
    background: var(--gray-light);
    border-color: var(--gray-medium);
}

.btn-primary:active,
.btn-secondary:active,
.btn-edit:active,
.btn-delete:active,
.btn-warning:active {
    transform: translateY(0);
}

/* Messages */
.error-message {
    color: var(--error);
    background: #fff5f5;
    border: 1px solid #feb2b2;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    margin-top: 1rem;
    display: none;
    font-size: 0.875rem;
}

.error-message.show {
    display: block;
}

.success-message {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #22543d;
    padding: 1rem;
    border-radius: var(--radius);
    margin-top: 1rem;
}

.success-message h3 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.success-message strong {
    font-size: 1.2rem;
    color: var(--success);
}

.small-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.empty-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem 2rem;
    font-size: 0.95rem;
}

/* Dashboard Header */
.dashboard-header {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.dashboard-header h1 {
    color: var(--black);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.back-to-site {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
}

.back-to-site:hover {
    color: var(--primary-orange);
    background: var(--gray-lighter);
}

.back-to-site svg {
    width: 16px;
    height: 16px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-actions span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Dashboard Main */
.dashboard-main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.view-container {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

/* Admin View */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.admin-header h2 {
    color: var(--black);
    font-size: 1.5rem;
    font-weight: 600;
}

.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.client-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.client-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-orange);
    transform: translateY(-2px);
}

.client-card h3 {
    color: var(--black);
    margin-bottom: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.client-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.client-info p {
    margin-bottom: 0.5rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

/* Client Detail View */
.client-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.client-detail-header h2 {
    color: var(--black);
    flex: 1;
    font-size: 1.5rem;
    font-weight: 600;
}

.client-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.workout-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.workout-section-header h3 {
    color: var(--black);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.workout-section-header .btn-primary {
    width: auto;
}

.access-code-display {
    margin-bottom: 2rem;
}

.access-code-box {
    background: var(--gray-lighter);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.access-code-box strong {
    color: var(--black);
    font-size: 0.875rem;
    font-weight: 600;
}

.access-code-box code {
    background: var(--white);
    padding: 0.625rem 1rem;
    border-radius: var(--radius);
    font-size: 1.125rem;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    color: var(--primary-orange);
    font-weight: 600;
    border: 1px solid var(--border);
    flex: 1;
    min-width: 120px;
}

.hidden-code {
    letter-spacing: 4px;
}

/* Workout Lists */
.workout-list {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.list-header h3 {
    color: var(--black);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.list-actions {
    display: flex;
    gap: 0.5rem;
}

.task-list {
    list-style: none;
    margin-bottom: 1rem;
}

.task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    background: var(--white);
    transition: all 0.3s ease;
    gap: 1rem;
    cursor: pointer;
    user-select: none;
}

.task-item:hover {
    background: var(--gray-lighter);
    border-color: var(--gray-medium);
}

.task-item.completed {
    background: var(--gray-lighter);
    opacity: 0.65;
}

.task-item.completed .task-name {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.task-item.completed .task-reps {
    color: var(--gray-medium);
}

.task-item.completed::before {
    content: '✓';
    color: var(--success);
    font-weight: bold;
    font-size: 1.25rem;
    margin-right: 0.5rem;
}

.task-checkbox-indicator {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border: 2px solid var(--border);
    border-radius: 6px;
    margin-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    transition: all 0.2s ease;
}

.task-checkbox-indicator svg {
    width: 18px;
    height: 18px;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
    color: var(--white);
}

.task-item.completed .task-checkbox-indicator {
    background: var(--primary-orange);
    border-color: var(--primary-orange);
}

.task-item.completed .task-checkbox-indicator svg {
    opacity: 1;
    transform: scale(1);
}

.task-item:hover .task-checkbox-indicator {
    border-color: var(--primary-orange);
    background: var(--gray-lighter);
}

.task-item.completed:hover .task-checkbox-indicator {
    background: var(--primary-orange-dark);
    border-color: var(--primary-orange-dark);
}

.task-info {
    flex: 1;
    min-width: 0;
}

.task-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.task-reps {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background: var(--white);
    margin: 5% auto;
    padding: 2rem;
    border-radius: var(--radius);
    max-width: 500px;
    position: relative;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.close:hover {
    color: var(--black);
    background: var(--gray-lighter);
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: var(--black);
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    line-height: 1.6;
}

.input-with-button {
    display: flex;
    gap: 0.5rem;
}

.input-with-button input {
    flex: 1;
}

.input-with-button .btn-secondary {
    width: auto;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 768px) {
    .login-box {
        padding: 2rem;
    }

    .dashboard-main {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .view-container {
        padding: 1.5rem;
    }

    .clients-grid {
        grid-template-columns: 1fr;
    }

    .client-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .client-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .client-actions button {
        flex: 1;
        min-width: auto;
        padding: 0.625rem 0.5rem;
        font-size: 0.8125rem;
    }

    /* Mobile Header */
    .header-content {
        padding: 0 1rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .header-left {
        flex-wrap: wrap;
        gap: 0.75rem;
        width: 100%;
        justify-content: space-between;
    }

    .dashboard-header h1 {
        font-size: 1.25rem;
    }

    .back-to-site {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }

    .back-to-site svg {
        width: 14px;
        height: 14px;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .header-actions span {
        font-size: 0.8rem;
    }

    #logoutBtn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    /* Task Items Mobile */
    .task-item {
        flex-wrap: nowrap;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .task-checkbox-indicator {
        width: 24px;
        height: 24px;
        min-width: 24px;
    }

    .task-info {
        width: 100%;
    }

    .task-actions {
        width: 100%;
        justify-content: flex-end;
        gap: 0.5rem;
    }

    .task-actions button {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }

    /* Workout Lists Mobile */
    .workout-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .workout-section-header .btn-primary {
        width: 100%;
    }

    .list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .list-actions {
        width: 100%;
        justify-content: flex-start;
    }

    /* Modal Mobile */
    .modal-content {
        margin: 10% auto;
        padding: 1.5rem;
        max-width: 90%;
    }

    .modal-content h2 {
        font-size: 1.125rem;
    }

    /* Buttons Mobile */
    .btn-primary,
    .btn-secondary,
    .btn-edit,
    .btn-delete,
    .btn-warning {
        font-size: 0.8rem;
        padding: 0.625rem 1rem;
    }

    /* Access Code Display Mobile */
    .access-code-box {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
    }

    .access-code-box code {
        width: 100%;
        text-align: center;
        font-size: 1rem;
    }
}

/* Small Mobile Specific */
@media (max-width: 480px) {
    .dashboard-header h1 {
        font-size: 1.125rem;
    }

    .back-to-site {
        display: none;
    }

    .header-actions {
        justify-content: center;
    }

    .view-container {
        padding: 1rem;
    }

    .client-actions button {
        font-size: 0.75rem;
        padding: 0.5rem 0.875rem;
    }

    .workout-section-header h3 {
        font-size: 1.125rem;
    }
}

/* Focus visible for accessibility */
button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary-orange);
    outline-offset: 2px;
}
