/* HCAI Custom Styles - Liquid Glass Redesign */

:root {
    --primary-orange: #FF6B35;
    --light-orange-bg: #f5e4da;
    --card-header-bg: #ffba90;
    --dark-text: rgb(44 62 80 / 1);
    --light-text: #FFFFFF;

    /* New variables for the glass effect */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --blur-intensity: 15px;
    --heading-color-static: #2c3e50; /* Fallback for non-gradient headings */
    
    /* PWA-specific variables */
    --pwa-primary: #0d6efd;
    --pwa-success: #198754;
    --pwa-warning: #ffc107;
    --pwa-danger: #dc3545;
    --pwa-info: #0dcaf0;
}

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

body {
    background: linear-gradient(135deg, #ff9a8b 0%, #ff6a88 50%, #ff99ac 100%);
    background-attachment: fixed;
    color: var(--dark-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
    line-height: 1.6;
    height: 100vh;
    overflow-x: hidden;
}

.navbar-custom {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-intensity));
    -webkit-backdrop-filter: blur(var(--blur-intensity));
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 24px;
}

.brand {
    color: var(--light-text);
    font-weight: 800;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    text-decoration: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.brand img {
    height: 36px;
    vertical-align: middle;
    margin: 8px 10px 8px 0;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}

.nav-wrap {
    display:flex;
    align-items:center;
    justify-content:center;
    gap:16px;
    padding: 10px 16px;
}

.hero {
    text-align:center;
    padding: 48px 16px;
}
.hero h1 {
    margin-bottom: 14px;
    font-size: 2.5rem;
    color: var(--light-text);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.hero p {
    color: var(--light-text);
    font-size: 1.1rem;
    opacity: 0.9;
}

.cta {
    display:flex;
    gap: 16px;
    justify-content:center;
    margin-top: 24px;
}

.card-surface {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-intensity));
    -webkit-backdrop-filter: blur(var(--blur-intensity));
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
    padding: 24px 32px;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.btn-primary {
    background-color: var(--primary-orange);
    border-color: var(--primary-orange);
    color: var(--light-text);
}
.btn-primary:hover {
    background-color: #e65c2e;
    border-color: #e65c2e;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.btn-secondary {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--light-text);
}
.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.btn:disabled, .btn[disabled] {
    background-color: #ccc !important;
    border-color: #ccc !important;
    color: #666 !important;
    cursor: not-allowed !important;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--heading-color-static);
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.text-muted { color: #eee; opacity: 0.9; }

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px 20px;
}
.form-field-span-2 {
    grid-column: span 2;
}
.form-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark-text);
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    min-height: 44px;
    color: var(--dark-text);
    font-size: 1rem;
    transition: all 0.2s ease-in-out;
}
.form-control::placeholder {
    color: rgba(44, 62, 80, 0.7);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-orange);
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.3);
}
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%232c3e50' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.7rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.8rem;
}

/* Custom alert styles */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-top: 16px;
    border: 1px solid transparent;
}
.alert-info {
    background-color: rgba(52, 152, 219, 0.2);
    border-color: rgba(52, 152, 219, 0.4);
    color: #2980b9;
}
.alert-success {
    background-color: rgba(46, 204, 113, 0.2);
    border-color: rgba(46, 204, 113, 0.4);
    color: #218c53;
}
.alert-danger {
    background-color: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.4);
    color: #c0392b;
}

html, body {
    height: 100%;
}
body {
    display: flex;
    flex-direction: column;
}
main {
    flex: 1 0 auto;
}
.footer {
    flex-shrink: 0;
    color: var(--light-text);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.footer .container {
    padding: 20px 24px;
    text-align: center;
}

.footer p {
    margin: 0;
}

/* Mobile polish */
@media (max-width: 768px) {
    .container { padding: 16px; }
    .hero { padding: 32px 16px; }
    .hero h1 { font-size: 2rem; }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-field-span-2 {
        grid-column: span 1;
    }
}

.answer-option.correct { border-color: #28a745; background: rgba(40,167,69,0.1); }
.answer-option.incorrect { border-color: #c0392b; background: rgba(231,76,60,0.1); }
.answer-option.incorrect.selected { border-color: #c0392b; background: rgba(231,76,60,0.1); }

/* PWA-specific styles */
#offline-indicator {
    background: var(--pwa-warning);
    border-color: var(--pwa-warning);
    color: #000;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(255, 193, 7, 0.3);
}

#pwa-install-btn {
    transition: all 0.3s ease;
}

#pwa-install-btn:hover {
    transform: scale(1.1);
}

#pwa-install-btn button {
    background: var(--pwa-primary);
    border: none;
    color: white;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

#pwa-install-btn button:hover {
    background: #0b5ed7;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.4);
}

/* Toast container styles */
#toast-container {
    z-index: 1070;
}

.toast {
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: none;
}

/* PWA app-like experience */
@media (display-mode: standalone) {
    body {
        padding-top: 0;
    }
    
    .navbar-custom {
        padding-top: env(safe-area-inset-top);
    }
    
    #pwa-install-btn {
        display: none !important;
    }
}

/* Offline page specific styles */
.offline-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.offline-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 3rem;
    text-align: center;
    max-width: 500px;
    width: 90%;
}

.offline-icon {
    font-size: 4rem;
    color: var(--pwa-danger);
    margin-bottom: 1rem;
}

.retry-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    color: white;
}

.cached-pages {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.cached-pages h5 {
    color: #6c757d;
    margin-bottom: 1rem;
}

.page-link {
    display: inline-block;
    margin: 0.5rem;
    padding: 8px 16px;
    background: #f8f9fa;
    border-radius: 20px;
    text-decoration: none;
    color: #495057;
    transition: all 0.3s ease;
}

.page-link:hover {
    background: #e9ecef;
    color: #212529;
    text-decoration: none;
}

.offline-status {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Loading states for PWA */
.pwa-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* PWA install prompt styles */
.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 1rem;
    z-index: 1060;
    max-width: 400px;
    width: 90%;
}

.pwa-install-prompt .btn {
    margin: 0.25rem;
}