/* ========================================
   KIOSK CSS - Touch-Friendly Interface
   ======================================== */

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #4a5568;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --light: #f7fafc;
    --dark: #1a202c;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-lg: 16px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    background: var(--light);
    color: var(--dark);
    font-size: 18px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Touch-friendly buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 56px;
    touch-action: manipulation;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-large {
    padding: 20px 48px;
    font-size: 20px;
    min-height: 64px;
}

/* Kiosk Container */
.kiosk-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Kiosk Home */
.kiosk-home {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 40px;
}

.kiosk-home.has-header-image {
    padding-top: 0;
}

/* Header Image/Banner */
.kiosk-header-image {
    width: calc(100% + 80px);
    margin: -40px -40px 20px -40px;
    position: relative;
    overflow: hidden;
}

.kiosk-header-image .header-banner {
    width: 100%;
    height: auto;
    max-height: 330px;
    object-fit: cover;
    display: block;
}

/* Adjust kiosk-home padding when header image is present */
.kiosk-home:has(.kiosk-header-image) {
    padding-top: 0;
}

.kiosk-header {
    text-align: center;
    padding: 20px 0;
}

.kiosk-logo {
    max-width: 150px;
    max-height: 100px;
    object-fit: contain;
    margin-bottom: 16px;
}

.kiosk-title {
    font-size: 36px;
    font-weight: 700;
    color: var(--dark);
}

.welcome-message {
    text-align: center;
    font-size: 24px;
    color: var(--secondary);
    margin: 20px 0 40px;
}

/* Button Grid */
.button-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 32px;
    overflow-y: auto;
    padding: 20px 0;
}

.button-group {
    margin-bottom: 24px;
}

.group-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--secondary);
}

.group-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.kiosk-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 24px;
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 22px;
    font-weight: 600;
    color: var(--dark);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 140px;
    box-shadow: var(--shadow);
}

.kiosk-button:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.kiosk-button:active {
    transform: translateY(0);
}

.kiosk-button i {
    font-size: 48px;
    color: var(--primary);
}

.kiosk-footer {
    text-align: center;
    padding: 20px;
    color: var(--secondary);
}

/* Form Styles */
.kiosk-form {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--white);
}

/* Cognito Form Container */
.cognito-form-container {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: var(--white);
    display: flex;
    flex-direction: column;
}

.cognito-form-container iframe {
    flex: 1;
    display: block;
    width: 100%;
    min-height: 100%;
    border: none;
    background: var(--white);
}

.form-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 40px;
    background: var(--light);
    border-bottom: 1px solid var(--border);
}

.back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    cursor: pointer;
    color: var(--secondary);
}

.form-title {
    font-size: 28px;
    font-weight: 700;
}

.form-description {
    padding: 20px 40px;
    font-size: 18px;
    color: var(--secondary);
    background: var(--light);
}

.touch-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.form-fields {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
}

.form-group {
    margin-bottom: 32px;
}

.form-label {
    display: block;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--dark);
}

.form-label .required {
    color: var(--danger);
}

.help-text {
    display: block;
    font-size: 14px;
    color: var(--secondary);
    margin-bottom: 8px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 16px 20px;
    font-size: 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

/* Radio and Checkbox */
.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-option,
.checkbox-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--light);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.radio-option:hover,
.checkbox-option:hover {
    border-color: var(--primary);
}

.radio-option input,
.checkbox-option input {
    width: 24px;
    height: 24px;
    accent-color: var(--primary);
}

.radio-label,
.checkbox-label {
    font-size: 18px;
}

/* Signature Pad */
.signature-group {
    margin-top: 40px;
}

.signature-pad-container {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.signature-pad {
    width: 100%;
    height: 200px;
    background: var(--white);
    touch-action: none;
}

.signature-controls {
    padding: 12px;
    border-top: 1px solid var(--border);
    text-align: right;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 20px;
    padding: 20px 40px;
    background: var(--light);
    border-top: 1px solid var(--border);
}

.form-actions .btn {
    flex: 1;
}

/* Error Messages */
.error-message {
    display: block;
    color: var(--danger);
    font-size: 14px;
    margin-top: 8px;
}

/* Cart Styles */
.kiosk-cart {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--light);
}

.cart-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 40px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.cart-title {
    font-size: 28px;
    font-weight: 700;
}

.cart-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    padding: 24px;
    overflow: hidden;
}

.cart-items-section {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.category-tabs {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--white);
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 16px;
}

.category-tab {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    background: var(--light);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
}

.category-tab.active {
    background: var(--primary);
    color: white;
}

.items-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    overflow-y: auto;
    padding: 4px;
}

.item-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.item-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.item-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 12px;
    background: var(--light);
}

.item-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.item-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

/* Cart Summary */
.cart-summary-section {
    display: flex;
    flex-direction: column;
}

.cart-summary {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.summary-title {
    font-size: 20px;
    font-weight: 700;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-weight: 500;
}

.cart-item-modifiers {
    font-size: 14px;
    color: var(--secondary);
}

.cart-item-price {
    font-weight: 600;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 8px;
}

.empty-cart {
    text-align: center;
    padding: 40px 20px;
    color: var(--secondary);
}

.empty-cart i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.cart-totals {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 16px;
}

.total-final {
    font-size: 20px;
    font-weight: 700;
    padding-top: 12px;
    border-top: 2px solid var(--border);
}

.checkout-btn {
    margin: 16px;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--light);
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
}

/* Success Modal */
.success-modal {
    text-align: center;
}

.success-icon {
    font-size: 80px;
    color: var(--success);
    margin-bottom: 24px;
}

.success-title {
    font-size: 32px;
    margin-bottom: 12px;
}

.success-message {
    font-size: 18px;
    color: var(--secondary);
    margin-bottom: 32px;
}

/* Screensaver */
.screensaver {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--dark);
    z-index: 2000;
}

.screensaver.hidden {
    display: none;
}

.screensaver-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screensaver-content img,
.screensaver-content video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.screensaver-tap-message {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 18px;
    opacity: 0.7;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1500;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 20px;
    font-size: 18px;
    color: var(--secondary);
}

/* Toast Messages */
.toast-container {
    position: fixed;
    bottom: 40px;
    right: 40px;
    z-index: 3000;
}

.toast {
    padding: 16px 24px;
    background: var(--dark);
    color: white;
    border-radius: var(--radius);
    margin-bottom: 12px;
    animation: slideIn 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Portrait Mode */
@media (orientation: portrait) {
    .cart-layout {
        grid-template-columns: 1fr;
    }
    
    .cart-summary-section {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: auto;
        max-height: 50vh;
    }
}

/* Landscape adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .kiosk-home {
        padding: 20px;
    }
    
    .kiosk-title {
        font-size: 28px;
    }
    
    .welcome-message {
        font-size: 18px;
        margin: 10px 0 20px;
    }
    
    .kiosk-button {
        padding: 24px 16px;
        min-height: 100px;
    }
}
