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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    background: #f5f5f5;
}

.hidden {
    display: none !important;
}

/* Navigation */
.navbar {
    background: #1a1a1a;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#user-info {
    color: #ddd;
    font-size: 0.9rem;
}

/* Main Content */
#home-view, #playlist-view {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    margin-bottom: 3rem;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Playlists Section */
#playlists-section h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #333;
}

#playlists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.playlist-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.playlist-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.playlist-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.playlist-card-content {
    padding: 1.5rem;
}

.playlist-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.playlist-card p {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.playlist-card .video-count {
    display: inline-block;
    background: #f0f0f0;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #666;
}

/* Playlist View */
.playlist-header {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
}

.back-button {
    background: transparent;
    color: #667eea;
    border: none;
    font-size: 1rem;
    padding: 0.5rem 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-button:hover {
    border-color: #667eea;
}

.playlist-info {
    flex: 1;
}

.playlist-info h1 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.playlist-info p {
    font-size: 1rem;
    color: #666;
}

.save-progress-btn {
    background: #28a745;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
}

.save-progress-btn:hover {
    background: #218838;
}

.save-progress-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.save-progress-btn.saved {
    background: #007bff;
}

.save-progress-btn.saved:hover {
    background: #0056b3;
}

/* Guest Save Notice */
.guest-save-notice {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    text-align: center;
}

.guest-save-notice p {
    margin: 0;
    color: #856404;
    font-size: 0.95rem;
}

.guest-save-notice a {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
}

.guest-save-notice a:hover {
    text-decoration: underline;
}

/* Video Table */
.video-table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.video-table {
    width: 100%;
    border-collapse: collapse;
}

.video-table thead {
    background: #f8f9fa;
}

.video-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
}

.video-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}

.video-table tbody tr {
    transition: background 0.2s ease;
}

.video-table tbody tr:hover {
    background: #f8f9fa;
}

.col-order {
    width: 60px;
    text-align: center;
}

.col-title {
    width: 30%;
}

.col-description {
    width: 35%;
}

.col-duration {
    width: 100px;
}

.col-status {
    width: 120px;
}

.col-action {
    width: 150px;
}

.video-title {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.video-description {
    color: #666;
    font-size: 0.9rem;
}

.status-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-in-progress {
    background: #fff3cd;
    color: #856404;
}

.status-not-started {
    background: #f0f0f0;
    color: #666;
}

/* Buttons */
button {
    padding: 0.75rem 1.5rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
    font-weight: 500;
}

button:hover {
    background: #5568d3;
}

.btn-watch {
    background: #667eea;
    padding: 0.6rem 1.25rem;
    font-size: 0.95rem;
}

.btn-watch:hover {
    background: #5568d3;
}

#auth-button {
    background: transparent;
    border: 2px solid white;
}

#auth-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

#signout-button {
    background: #dc3545;
}

#signout-button:hover {
    background: #c82333;
}

.primary-button {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    margin-top: 1rem;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 1100px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.video-modal {
    width: 100%;
}

.auth-modal-content {
    max-width: 450px;
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 1.5rem;
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.close-button:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Exercise Table */
.exercise-table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.exercise-table {
    width: 100%;
    border-collapse: collapse;
}

.exercise-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.exercise-table th {
    padding: 1.25rem 1.5rem;
    text-align: left;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.exercise-table td {
    padding: 1.5rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

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

.exercise-table tbody tr {
    transition: background 0.2s ease;
}

.exercise-table tbody tr:hover {
    background: #f8f9fa;
}

/* Column widths */
.col-video {
    width: 30%;
}

.col-sets-reps {
    width: 20%;
}

.col-equipment {
    width: 20%;
}

.col-completion {
    width: 30%;
}

/* Video thumbnail and info */
.exercise-video-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.video-thumbnail {
    width: 160px;
    height: 90px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
    background: #e0e0e0;
    position: relative;
}

.video-thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Video Player */
#player {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

#video-info {
    margin-top: 1.5rem;
}

#video-info h2 {
    color: #333;
    font-size: 1.75rem;
}

/* Play button overlay */
.video-thumbnail-wrapper {
    position: relative;
    width: 160px;
    height: 90px;
    flex-shrink: 0;
    cursor: pointer;
}

.video-thumbnail-wrapper::after {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    padding-left: 4px;
    transition: background 0.2s ease;
}

.video-thumbnail-wrapper:hover::after {
    background: rgba(102, 126, 234, 0.9);
}

.exercise-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: #333;
}

/* Sets and reps */
.sets-reps-text {
    color: #555;
    font-size: 0.95rem;
}

/* Equipment badge */
.equipment-badge {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

/* Easier difficulty - Green */
.equipment-badge.badge-easier {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* More Challenging difficulty - Orange */
.equipment-badge.badge-more-challenging {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Challenging difficulty - Red */
.equipment-badge.badge-challenging {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Neutral/Default - Gray (no difficulty specified) */
.equipment-badge.badge-neutral {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #dee2e6;
}

/* No equipment */
.no-equipment {
    color: #999;
    font-style: italic;
}

/* Set counter */
.sets-counter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.counter-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 6px;
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.counter-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
    transform: scale(1.05);
}

.counter-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.counter-btn:disabled {
    border-color: #ddd;
    color: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
}

.minus-btn {
    border-color: #dc3545;
    color: #dc3545;
}

.minus-btn:hover:not(:disabled) {
    background: #dc3545;
    color: white;
}

.plus-btn {
    border-color: #28a745;
    color: #28a745;
}

.plus-btn:hover:not(:disabled) {
    background: #28a745;
    color: white;
}

.sets-input {
    width: 60px;
    height: 36px;
    text-align: center;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    background: #f8f9fa;
    cursor: default;
}

.sets-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Remove spinner arrows from number input */
.sets-input::-webkit-inner-spin-button,
.sets-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sets-input[type=number] {
    -moz-appearance: textfield;
}

.sets-label {
    color: #666;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
}

.login-prompt {
    color: #999;
    font-size: 0.9rem;
    font-style: italic;
}

.login-prompt a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.login-prompt a:hover {
    text-decoration: underline;
}



/* Auth Tabs */
#auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #eee;
}

.tab-button {
    flex: 1;
    background: transparent;
    color: #666;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-button:hover {
    background: #f8f9fa;
}

/* Auth Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form h2 {
    text-align: center;
    color: #333;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    text-align: center;
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.auth-form input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.auth-form input:focus {
    outline: none;
    border-color: #667eea;
}

.form-message {
    text-align: center;
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.form-message.error {
    background: #fee;
    color: #c00;
}

.form-message.success {
    background: #efe;
    color: #060;
}

.auth-prompt {
    text-align: center;
    padding: 60px 20px;
    max-width: 500px;
    margin: 0 auto;
    background: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.auth-prompt h3 {
    font-size: 24px;
    margin-bottom: 16px;
    color: #333;
}

.auth-prompt p {
    font-size: 16px;
    color: #666;
    margin-bottom: 24px;
    line-height: 1.6;
}

.auth-prompt .primary-button {
    padding: 12px 32px;
    font-size: 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

.auth-prompt .primary-button:hover {
    background: #0056b3;
}

/* Recent Activity Section */
#recent-activity-section {
    margin-bottom: 40px;
}

#recent-activity-section h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #333;
}

/* Recent Activity Card Container */
#recent-activity-card {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

/* Recent activity stats styling */
.recent-activity-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.completion-date {
    display: block;
    font-size: 0.85rem;
    color: #28a745;
    font-weight: 500;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Responsive */
@media (max-width: 1024px) {
    .playlist-header {
        flex-direction: column;
    }

    .save-progress-btn {
        width: 100%;
    }

    .guest-save-notice {
        width: 100%;
    }

    .video-thumbnail-wrapper {
        width: 120px;
        height: 68px;
    }

    .video-thumbnail {
        width: 120px;
        height: 68px;
    }
}

@media (max-width: 768px) {
    .exercise-table {
        font-size: 0.85rem;
    }

    .exercise-table th,
    .exercise-table td {
        padding: 1rem 0.75rem;
    }

    .exercise-video-cell {
        flex-direction: column;
        align-items: flex-start;
    }

    .video-thumbnail-wrapper {
        width: 100%;
        max-width: 200px;
    }

    .video-thumbnail {
        width: 100%;
    }

    .col-equipment,
    .col-sets-reps {
        display: none;
    }

    .playlist-info h1 {
        font-size: 1.5rem;
    }
}