/* Lumio Cast - Sender Web App Styles
   Tech that sparks joy */

:root {
    /* Lumio Brand Colors */
    --lumio-black: #171717;        /* Cod Grey - primary background */
    --lumio-green: #82F213;         /* Lime - signature accent */
    --lumio-white: #FFFFFF;         /* White - text/secondary */

    /* Derived colors */
    --lumio-dark: #0F0F0F;          /* Darker shade for cards */
    --lumio-gray: #2A2A2A;          /* Gray for borders */
    --lumio-light-gray: #6B6B6B;   /* Light gray for secondary text */
    --lumio-green-hover: #6BC20F;  /* Darker green for hover states */
    --lumio-green-glow: rgba(130, 242, 19, 0.3); /* Green glow effect */
    --lumio-danger: #FF3B30;        /* Red for errors */
    --lumio-danger-hover: #E62E24;  /* Darker red for hover */
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Red Hat Text', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--lumio-black);
    color: var(--lumio-white);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Subtle gradient background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%,
                rgba(130, 242, 19, 0.05) 0%,
                transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.container {
    width: 90%;
    max-width: 600px;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Logo Container */
.logo-container {
    text-align: center;
    margin: 0 0 2rem 0;
    padding: 1rem 0;
}

.lumio-wordmark {
    max-width: 200px;
    height: auto;
    display: inline-block;
}

/* Screen management */
.screen {
    display: none;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.active {
    display: block;
}

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

/* Typography */
h1, h2, h3 {
    font-family: 'Darker Grotesque', sans-serif;
}

h1 {
    font-size: 2.5rem;
    margin: 0 0 1rem 0;
    text-align: center;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.75rem;
    margin: 0.5rem 0 1rem 0;
    text-align: center;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--lumio-white);
}

h3 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem 0;
    font-weight: 600;
    color: var(--lumio-light-gray);
}

p {
    font-family: 'Red Hat Text', sans-serif;
    font-size: 1.125rem;
    color: var(--lumio-light-gray);
    text-align: center;
    margin: 0 0 2rem 0;
    line-height: 1.6;
}

/* PIN Entry Screen */
.pin-input {
    margin: 2rem 0;
}

.pin-input input {
    width: 100%;
    font-family: 'Darker Grotesque', sans-serif;
    font-size: 3.5rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 1.2rem;
    padding: 1.5rem;
    border: 2px solid var(--lumio-gray);
    border-radius: 16px;
    background: var(--lumio-dark);
    color: var(--lumio-white);
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-input input:focus {
    border-color: var(--lumio-green);
    box-shadow: 0 0 0 4px var(--lumio-green-glow);
}

.pin-input input::placeholder {
    color: var(--lumio-light-gray);
    opacity: 0.4;
    font-weight: 400;
}

/* Help text */
.help-text {
    margin-top: 3rem;
    padding: 1.5rem;
    background: var(--lumio-dark);
    border-radius: 16px;
    text-align: left;
    border: 1px solid var(--lumio-gray);
    position: relative;
    overflow: hidden;
}

.help-text::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--lumio-green);
}

.help-text h3 {
    margin-top: 0;
    margin-left: 0.5rem;
    font-family: 'Darker Grotesque', sans-serif;
}

.help-text ol {
    margin: 0;
    padding-left: 2rem;
    color: var(--lumio-white);
}

.help-text li {
    margin: 0.75rem 0;
    font-size: 1rem;
    line-height: 1.6;
    font-family: 'Red Hat Text', sans-serif;
}

/* Audio Selection */
.audio-selection {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--lumio-dark);
    border-radius: 16px;
    border: 1px solid var(--lumio-gray);
}

.audio-label {
    display: block;
    font-family: 'Darker Grotesque', sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--lumio-white);
}

.audio-options {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.radio-option {
    flex: 1;
    min-width: 120px;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 0.75rem;
    background: var(--lumio-black);
    border: 2px solid var(--lumio-gray);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
}

.radio-option input[type="radio"]:checked + .radio-label {
    border-color: var(--lumio-green);
    background: rgba(130, 242, 19, 0.1);
}

.radio-label:hover {
    border-color: var(--lumio-green);
    transform: translateY(-2px);
}

.radio-label .icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.radio-label .text {
    font-size: 0.875rem;
    font-family: 'Red Hat Text', sans-serif;
    color: var(--lumio-light-gray);
    font-weight: 500;
}

.radio-option input[type="radio"]:checked + .radio-label .text {
    color: var(--lumio-green);
    font-weight: 700;
}

.audio-hint {
    font-size: 0.8125rem;
    color: var(--lumio-light-gray);
    margin: 0;
    line-height: 1.5;
    font-family: 'Red Hat Text', sans-serif;
    opacity: 0.8;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger {
    width: 100%;
    padding: 1.25rem 2rem;
    font-family: 'Darker Grotesque', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--lumio-green);
    color: var(--lumio-black);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    background: var(--lumio-green-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--lumio-green-glow);
}

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

.btn-secondary {
    background: transparent;
    color: var(--lumio-white);
    border: 2px solid var(--lumio-gray);
}

.btn-secondary:hover {
    background: var(--lumio-dark);
    border-color: var(--lumio-green);
    color: var(--lumio-green);
}

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

.btn-danger:hover {
    background: var(--lumio-danger-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 59, 48, 0.3);
}

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

/* Connecting Screen */
.spinner {
    border: 3px solid var(--lumio-gray);
    border-top: 3px solid var(--lumio-green);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 2rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Connected Screen */
.status-bar {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.25rem;
    background: var(--lumio-dark);
    border-radius: 16px;
    border: 1px solid var(--lumio-gray);
}

.status-connected {
    font-family: 'Darker Grotesque', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--lumio-green);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.status-connected::before {
    content: '●';
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.preview-container {
    position: relative;
    margin: 2rem 0;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--lumio-gray);
}

#localPreview {
    width: 100%;
    max-height: 400px;
    display: block;
    background: #000;
}

.preview-label {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(23, 23, 23, 0.9);
    color: var(--lumio-green);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Darker Grotesque', sans-serif;
    backdrop-filter: blur(10px);
    border: 1px solid var(--lumio-green);
}

/* Source Controls - for Task 4.3 */
#sourceControls {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--lumio-dark);
    border-radius: 12px;
    border: 1px solid var(--lumio-gray);
}

.source-btn {
    flex: 1;
    padding: 0.75rem;
    background: transparent;
    border: 2px solid var(--lumio-gray);
    border-radius: 8px;
    color: var(--lumio-white);
    font-family: 'Darker Grotesque', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.source-btn:hover {
    border-color: var(--lumio-green);
    color: var(--lumio-green);
}

.source-btn.active {
    background: var(--lumio-green);
    color: var(--lumio-black);
    border-color: var(--lumio-green);
}

/* Statistics Panel */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--lumio-dark);
    border-radius: 16px;
    border: 1px solid var(--lumio-gray);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
}

.stat .label {
    font-family: 'Red Hat Text', sans-serif;
    font-size: 0.75rem;
    color: var(--lumio-light-gray);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}

.stat span:last-child {
    font-family: 'Darker Grotesque', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--lumio-green);
}

/* Error Screen */
.error-icon {
    font-size: 4rem;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--lumio-danger);
}

#errorTitle {
    color: var(--lumio-danger);
    font-family: 'Darker Grotesque', sans-serif;
}

#errorMessage {
    font-family: 'Red Hat Text', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--lumio-dark);
    border-radius: 12px;
    border-left: 4px solid var(--lumio-danger);
    color: var(--lumio-white);
}

/* Unsupported Browser Screen */
#unsupportedBrowserScreen .error-icon {
    color: #FFA500; /* Orange warning color */
}

.browser-warning {
    font-family: 'Red Hat Text', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--lumio-dark);
    border-radius: 12px;
    border-left: 4px solid #FFA500;
    color: var(--lumio-white);
}

#unsupportedBrowserScreen .help-text ul {
    list-style: none;
    padding-left: 1.5rem;
    margin: 1rem 0;
}

#unsupportedBrowserScreen .help-text li {
    margin: 1rem 0;
    font-size: 1rem;
    line-height: 1.6;
    padding-left: 1rem;
    position: relative;
}

#unsupportedBrowserScreen .help-text li::before {
    content: '✓';
    position: absolute;
    left: -0.5rem;
    color: var(--lumio-green);
    font-weight: bold;
}

#unsupportedBrowserScreen .help-text em {
    color: var(--lumio-light-gray);
    font-size: 0.9rem;
}

/* Loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(130, 242, 19, 0.2),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}

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

    .lumio-logo {
        font-size: 2.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .pin-input input {
        font-size: 2.5rem;
        letter-spacing: 0.8rem;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger {
        font-size: 1.125rem;
        padding: 1rem 1.5rem;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    #sourceControls {
        flex-direction: column;
    }

    .audio-options {
        flex-direction: column;
    }

    .radio-option {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .lumio-logo {
        font-size: 2rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .pin-input input {
        font-size: 2rem;
        letter-spacing: 0.5rem;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode is default, but provide high contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --lumio-green: #A4FF2B;
        --lumio-gray: #4A4A4A;
    }

    .btn-primary {
        font-weight: 900;
    }
}