/* =============================================================================
   SCORM Standalone Wrapper - Stylesheet
   REdI Brand Design System Applied
   ============================================================================= */

/* CSS Variables - REdI Brand System */
:root {
    /* Primary Colors - Coral */
    --primary-color: #E55B64;
    --primary-hover: #D14A53;
    --primary-active: #D14A53;
    --primary-light: #F08C92;

    /* Secondary Colors - Navy */
    --secondary-color: #1B3A5F;
    --secondary-hover: #122840;
    --secondary-light: #2A5080;

    /* Accent Colors - Teal */
    --accent-color: #2B9E9E;
    --accent-hover: #1F7A7A;
    --accent-light: #3DBDBD;
    --light-teal: #8DD4D4;

    /* Additional Brand Colors */
    --lime-color: #B8CC26;
    --sky-blue: #5DADE2;

    /* Semantic Colors */
    --success-color: #28A745;
    --success-bg: #D4EDDA;
    --error-color: #DC3545;
    --error-bg: #F8D7DA;
    --warning-color: #FFC107;
    --warning-bg: #FFF3CD;
    --info-color: #17A2B8;
    --info-bg: #D1ECF1;

    /* Neutral Colors */
    --text-color: #333333;
    --text-muted: #666666;
    --bg-color: #F5F5F5;
    --card-bg: #FFFFFF;
    --border-color: #E0E0E0;

    /* Typography */
    --font-primary: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-display: 'Bebas Neue', Impact, 'Arial Black', sans-serif;

    /* Spacing (0.25rem increments) */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-pill: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);

    /* Transitions */
    --transition: all 0.2s ease;
}

/* Base Reset & Typography */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* Typography */
h1, h2, h3, h4 {
    margin: 0 0 1rem 0;
    color: var(--text-color);
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
}

h2 {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.25;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
}

h4 {
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.4;
}

p {
    margin: 0 0 1rem 0;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

a:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.card-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    margin: 0;
}

/* Card Accent Variants */
.card-accent-coral {
    border-top: 4px solid var(--primary-color);
}

.card-accent-navy {
    border-top: 4px solid var(--secondary-color);
}

.card-accent-teal {
    border-top: 4px solid var(--accent-color);
}

/* Gradient Bar Component */
.gradient-bar {
    height: 4px;
    background: linear-gradient(90deg, var(--lime-color) 0%, var(--accent-color) 50%, var(--secondary-color) 100%);
    border-radius: var(--radius-sm);
}

/* Flexbox Utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

/* Grid Utilities */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(43, 158, 158, 0.2);
}

input.error,
select.error,
textarea.error {
    border-color: var(--error-color);
}

input.error:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

.form-error {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--error-color);
}

.form-help {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Buttons */
button, .btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    transition: var(--transition);
    user-select: none;
}

button:focus, .btn:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

.btn-primary {
    color: white;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    text-decoration: none;
}

.btn-primary:active:not(:disabled) {
    background-color: var(--primary-hover);
}

.btn-secondary {
    color: white;
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--secondary-hover);
    border-color: var(--secondary-hover);
    text-decoration: none;
}

.btn-outline {
    color: var(--primary-color);
    background-color: transparent;
    border-color: var(--primary-color);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
}

.btn-success {
    color: white;
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-success:hover:not(:disabled) {
    background-color: #1e7e34;
    border-color: #1e7e34;
    text-decoration: none;
}

.btn-danger {
    color: white;
    background-color: var(--error-color);
    border-color: var(--error-color);
}

.btn-danger:hover:not(:disabled) {
    background-color: #c82333;
    border-color: #c82333;
    text-decoration: none;
}

button:disabled, .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-full {
    width: 100%;
}

.btn-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid white;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
    border-left: 4px solid;
}

.alert-success {
    background-color: var(--success-bg);
    border-color: var(--success-color);
    color: #155724;
}

.alert-error {
    background-color: var(--error-bg);
    border-color: var(--error-color);
    color: #721c24;
}

.alert-warning {
    background-color: var(--warning-bg);
    border-color: var(--warning-color);
    color: #856404;
}

.alert-info {
    background-color: var(--info-bg);
    border-color: var(--info-color);
    color: #0c5460;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-radius: var(--radius-pill);
}

.badge-success {
    color: white;
    background-color: var(--success-color);
}

.badge-error {
    color: white;
    background-color: var(--error-color);
}

.badge-warning {
    color: var(--text-color);
    background-color: var(--warning-color);
}

.badge-info {
    color: white;
    background-color: var(--info-color);
}

.badge-coral {
    color: white;
    background-color: var(--primary-color);
}

.badge-navy {
    color: white;
    background-color: var(--secondary-color);
}

.badge-teal {
    color: white;
    background-color: var(--accent-color);
}

/* Header */
.header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
}

.header .container {
    padding-top: 0;
    padding-bottom: 0;
}

.logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
}

.logo:hover {
    text-decoration: none;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    font-weight: 500;
}

/* Auth Pages */
.subtitle {
    color: var(--text-muted);
    font-size: 1.125rem;
    margin-bottom: 2rem;
}

.auth-form {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    border-top: 4px solid var(--primary-color);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    max-width: 420px;
    margin: 0 auto 1.5rem;
}

.auth-form .btn {
    width: 100%;
    margin-top: 0.5rem;
}

.auth-links {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.error-message {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background-color: var(--error-bg);
    border-left: 4px solid var(--error-color);
    border-radius: var(--radius-md);
    color: #721c24;
    font-size: 0.875rem;
}

.field-error {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--error-color);
    min-height: 1.2em;
}

/* Player Page */
.player-body {
    margin: 0;
    overflow: hidden;
}

.player-body .gradient-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1001;
    border-radius: 0;
}

.player-body .player-header {
    margin-top: 4px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.player-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: white;
}

.player-user {
    font-size: 0.875rem;
    opacity: 0.85;
    color: rgba(255, 255, 255, 0.85);
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.player-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-radius: var(--radius-pill);
}

.status-completed {
    background-color: var(--success-color);
    color: white;
}

.status-in-progress {
    background-color: var(--accent-color);
    color: white;
}

.status-failed {
    background-color: var(--error-color);
    color: white;
}

.status-not-started {
    background-color: var(--text-muted);
    color: white;
}

.player-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
}

.player-container iframe {
    flex: 1;
    width: 100%;
    border: none;
}

.player-header {
    flex-shrink: 0;
    background-color: var(--secondary-color);
    color: white;
    border-bottom: 1px solid var(--secondary-hover);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-header .logo,
.player-header h1,
.player-header .user-name {
    color: white;
}

.player-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.player-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Completion Overlay */
.completion-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(27, 58, 95, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.completion-message.visible {
    display: flex;
}

.completion-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border-top: 4px solid var(--success-color);
    padding: 3rem;
    text-align: center;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
}

.completion-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: var(--success-color);
    color: white;
    font-size: 32px;
    font-weight: bold;
    line-height: 64px;
    text-align: center;
    margin: 0 auto 1rem;
}

.completion-content h2 {
    color: var(--success-color);
    margin-bottom: 0.75rem;
}

.completion-subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.completion-details {
    background-color: var(--bg-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.completion-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.completion-detail-row:last-child {
    border-bottom: none;
}

.completion-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.completion-value {
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.875rem;
}

.completion-email-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 1.5rem;
}

.completion-content p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Error text (inline) */
.error {
    color: var(--error-color);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: 1rem;
    color: var(--text-muted);
}

/* Progress Indicator */
.progress-bar {
    width: 100%;
    height: 4px;
    background-color: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--success-color);
    transition: width 0.3s ease;
}

/* Utilities */
.hidden {
    display: none;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.ml-1 { margin-left: 0.5rem; }
.ml-2 { margin-left: 1rem; }
.mr-1 { margin-right: 0.5rem; }
.mr-2 { margin-right: 1rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .grid-cols-2 {
        grid-template-columns: 1fr;
    }

    .player-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .user-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 0.875rem;
    }

    .container {
        padding: 0.75rem;
    }

    .card {
        padding: 1rem;
    }

    button, .btn {
        padding: 0.625rem 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.125rem;
    }
}
