* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Screen Management */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.3s ease;
}

.screen.hidden {
    display: none;
    opacity: 0;
}

/* Installation Screen */
.split-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.top-half {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    padding: 2rem;
}

.bottom-half {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.install-content {
    text-align: center;
    max-width: 400px;
}

.logo {
    width: 120px;
    height: 120px;
    margin-bottom: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.logo-small {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
    border-radius: 12px;
}

h1 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 2rem;
    font-weight: 700;
}

h2 {
    font-size: 1.8rem;
    color: white;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.install-instructions {
    background: #f5f7fa;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: left;
    line-height: 1.6;
    color: #555;
    font-size: 1rem;
}

.install-instructions strong {
    color: #2196F3;
    font-weight: 600;
}

.install-instructions ol {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.install-instructions li {
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: #667eea;
    margin-top: 1rem;
}

.btn-secondary:hover {
    background: #f5f7fa;
}

/* Scan Screen */
.scan-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
}

.scan-logo {
    width: 120px;
    height: auto;
    
    margin-top: 60px;
    animation: fadeInDown 0.6s ease;
}

.scan-logo-text {
    color: white;
    font-size: 24px;
    font-weight: 600;
    margin-top: 10px;
    margin-bottom: 130px;
    letter-spacing: 2px;
    animation: fadeInDown 0.6s ease;
}

.scan-title {
    font-size: 1.5rem;
    color: white;
    margin-bottom: 80px;
    font-weight: 400;
    max-width: 300px;
    line-height: 1.4;
    animation: fadeIn 0.8s ease;
}

.btn-scan-gradient {
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #5865F2 0%, #7C3AED 100%);
    color: white;
    text-transform: none;
    letter-spacing: 0.3px;
    animation: fadeInUp 1s ease;
}

.btn-scan-gradient:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
}

.btn-scan-gradient:active {
    transform: translateY(-1px);
}

.scan-subtitle {
    margin-top: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    animation: fadeIn 1.2s ease;
}

/* Mobile Landscape - Split Layout (2 columns) */
@media (orientation: landscape) and (max-height: 600px) {
    .scan-container {
        flex-direction: row;
        padding: 1.5rem 2rem;
        gap: 2rem;
        justify-content: space-around;
    }
    
    /* Left section - logo and title */
    .scan-container .scan-logo,
    .scan-container .scan-logo-text,
    .scan-container .scan-title
     {
        order: 1;
    }
    
    /* Right section - button and subtitle */
    .scan-container .btn-scan-gradient,
    .scan-container .scan-subtitle {
        order: 2;
    }
    
    /* Create 2 equal columns */
    .scan-container {
        display: grid;
        /*grid-template-columns: 1fr 1fr;*/
        grid-template-rows: auto auto;
        gap: 1rem 2rem;
    }
    
    .scan-logo {
        grid-column: 1;
        grid-row: 1;
        width: 80px;
        margin-bottom: 0.5rem;
        justify-self: center;
    }

    .scan-logo-text {
        grid-column: 1;
        grid-row: 2;
        font-size: 18px;
        margin-top: 0;
        margin-bottom: 1.5rem;
        justify-self: center;
    }
    
    .scan-title {
        grid-column: 1;
        grid-row: 3;
        font-size: 1.1rem;
        margin-bottom: 0;
        align-self: start;
    }
    
    .btn-scan-gradient {
        grid-column: 2;
        grid-row: 1;
        padding: 0.8rem 1.8rem;
        font-size: 0.9rem;
        align-self: center;
    }
    
    .scan-subtitle {
        grid-column: 2;
        grid-row: 2;
        margin-top: 0;
        font-size: 0.8rem;
        align-self: start;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Confirmation Screen */
.confirm-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.confirm-top {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: white;
}

.confirm-bottom {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.logo-medium {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
    border-radius: 16px;
}

.confirm-title {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 1rem;
    font-weight: 600;
    text-align: center;
}

.confirm-text {
    font-size: 1rem;
    color: #666;
    margin-bottom: 2rem;
    text-align: center;
    max-width: 320px;
    line-height: 1.5;
}

.btn-test {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-test:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.test-icon {
    width: 24px;
    height: 24px;
}

.btn-confirm,
.btn-change {
    width: 100%;
    max-width: 320px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-confirm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn-change {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-change:hover {
    background: #f5f7fa;
    transform: translateY(-2px);
}

/* Mobile adjustments for confirmation screen */
@media (max-width: 768px) {
    .confirm-top {
        padding: 1.5rem;
    }
    
    .confirm-bottom {
        padding: 1.5rem;
    }
    
    .logo-medium {
        width: 70px;
        height: 70px;
    }
    
    .confirm-title {
        font-size: 1.5rem;
    }
    
    .confirm-text {
        font-size: 0.95rem;
    }
    
    .btn-test {
        padding: 0.9rem 1.8rem;
        font-size: 1rem;
    }
    
    .btn-confirm,
    .btn-change {
        padding: 0.9rem 1.8rem;
        font-size: 1rem;
    }
}

/* Landscape layout for confirmation screen - Two columns */
@media (orientation: landscape) and (max-height: 600px) {
    .confirm-container {
        flex-direction: row;
        height: 100%;
    }
    
    .confirm-top {
        flex: 1;
        padding: 2rem;
        background: white;
        border-right: 1px solid #e0e0e0;
    }
    
    .confirm-bottom {
        flex: 1;
        padding: 2rem;
        justify-content: center;
    }
    
    .logo-medium {
        width: 70px;
        height: 70px;
        margin-bottom: 1.5rem;
    }
    
    .confirm-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .confirm-text {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
        max-width: 100%;
    }
    
    .btn-test {
        padding: 0.9rem 1.8rem;
        font-size: 1rem;
    }
    
    .btn-confirm,
    .btn-change {
        max-width: 100%;
        padding: 0.9rem 1.8rem;
        font-size: 1rem;
    }
}

/* QR Scanner */
.scanning-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
}

.qr-reader {
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
}

#reader video {
    width: 100%;
    height: auto;
    display: block;
}

/* Forms */
.form-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
}

.form-container form {
    width: 100%;
    max-width: 400px;
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.form-input {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
}

.helper-text {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #666;
    font-style: italic;
}

.form-container .btn-primary {
    width: 100%;
    margin-top: 1rem;
}

/* Error Messages */
.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    text-align: center;
    font-weight: 500;
}

.error-message.hidden {
    display: none;
}

/* Success Screen */
.success-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
}

.success-icon {
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: #4caf50;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.success-container h2 {
    margin-bottom: 1rem;
}

.success-container p {
    color: white;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    max-width: 400px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    color: #c62828;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.modal-content p {
    color: #555;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.loading-spinner.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .btn-scan {
        width: 160px;
        height: 160px;
    }

    .camera-icon {
        width: 60px;
        height: 60px;
    }

    .btn-scan span {
        font-size: 1.2rem;
    }

    .logo {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 480px) {
    .top-half,
    .bottom-half {
        padding: 1.5rem;
    }

    .install-instructions {
        font-size: 0.9rem;
        padding: 1rem;
    }

    h1 {
        font-size: 1.8rem;
    }
}

/* PWA Specific Styles */
@media all and (display-mode: standalone) {
    body {
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
}

/* Landscape Mode Optimizations */
@media (max-height: 600px) and (orientation: landscape) {
    /* Installation Screen - Side by Side Layout */
    .split-container {
        flex-direction: row;
    }

    .top-half,
    .bottom-half {
        flex: 1;
        padding: 1.5rem;
    }

    .top-half {
        border-right: 1px solid #e0e0e0;
    }

    .install-content {
        max-width: 100%;
    }

    .logo {
        width: 80px;
        height: 80px;
        margin-bottom: 1rem;
    }

    h1 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .install-instructions {
        font-size: 0.85rem;
        padding: 1rem;
    }

    /* Scan Button - Smaller for landscape */
    .btn-scan {
        width: 140px;
        height: 140px;
    }

    .camera-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 0.5rem;
    }

    .btn-scan span {
        font-size: 1.1rem;
    }

    /* QR Scanner - Horizontal layout */
    .scanning-container {
        flex-direction: row;
        padding: 1rem;
        gap: 1.5rem;
    }

    .qr-reader {
        max-width: 350px;
        margin-bottom: 0;
    }

    .scanning-container button {
        align-self: center;
    }

    /* Forms - Compact layout */
    .form-container {
        padding: 1rem;
    }

    .form-container form {
        max-width: 500px;
        padding: 1.5rem;
    }

    .logo-small {
        width: 50px;
        height: 50px;
        margin-bottom: 0.5rem;
    }

    h2 {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-input {
        padding: 0.75rem;
        font-size: 0.95rem;
    }

    .btn-primary,
    .btn-secondary {
        padding: 0.75rem 2rem;
        font-size: 1rem;
    }

    /* Success Screen - Compact */
    .success-container {
        padding: 1rem;
    }

    .success-icon {
        width: 80px;
        height: 80px;
        font-size: 3rem;
        margin-bottom: 1rem;
    }

    .success-container p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Error messages and helper text */
    .error-message {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .helper-text {
        font-size: 0.8rem;
    }

    /* Modal adjustments */
    .modal {
        padding: 1rem;
    }

    .modal-content {
        padding: 1.5rem;
        max-width: 500px;
    }

    .modal-content h3 {
        font-size: 1.3rem;
        margin-bottom: 0.75rem;
    }

    .modal-content p {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }
}
