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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f0f8ff;
    min-height: 100vh;
    /* padding-bottom: 40px; */
    position: relative;
}

body.dyslexic-font {
    font-family: 'OpenDyslexic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('/assets/OpenDyslexic-Regular.otf') format('opentype');
}

/* Header */
.app-header {
    background: url('images/wanaka.jpg') center/cover;
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: start;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.15);
    position: relative;
    max-width: 860px;
    margin: 0 auto;
    border-radius: 0 0 16px 16px;
    min-height: 150px;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.app-logo {
    height: 90px;
    width: auto;
    margin: auto;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
}

.account-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
    z-index: 1;
}

.account-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.account-btn .material-symbols-outlined {
    font-size: 28px;
    color: white;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    padding-bottom: 0;
    position: relative;
}

/* Welcome Section */
.welcome-section {
    padding: 40px 0 32px;
}

.welcome-subtitle {
    font-size: 1.125rem;
    color: #64748b;
    margin-top: 8px;
}

.greeting-text {
    font-size: 2rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.2;
}

/* Section Title */
.section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 16px;
    letter-spacing: 0.3px;
}

/* Quick Access Section */
.quick-access-section {
    margin-bottom: 26px;
    padding-bottom: 26px;
    border-bottom: 2px solid #e2e8f0;
}

.access-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.access-link {
    background: white;
    border-radius: 12px;
    padding: 18px 20px;
    padding-right: 32px;
    height: 80px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    /* border: 2px solid transparent; */
    border-left: 5px solid #3498db;
    border-radius: 6px 12px 12px 6px;
    /* bg image opacity down */
    background: #fff;
    position: relative;
    overflow: hidden;
}

.module-link {
    opacity: 0;
    animation: fadeInModule 0.4s ease-out forwards;
}

.access-link:hover {
    box-shadow: 0 4px 8px rgba(30, 64, 175, 0.1);
    border-color: #3b82f6;
}

.access-link:hover .link-bg-image {
    width: 115%;
}

.access-card:hover .link-arrow {
    transform: translateX(8px);
}

.btn-grad {
    background-image: linear-gradient(135deg, #3498db1c 0%, #0a9afa83 50%, #3498db27 100%);
    transition: 0.5s;
    background-size: 210% auto;
}

.btn-grad:hover {
    background-position: right center;
}

.link-bg-image {
    position: absolute;
    top: 90%;
    left: 50%;
    transform: translate(-50%, -50%);

    opacity: 0.5;
    border-radius: 12px;
    z-index: -1;
    object-fit: cover;
    width: 110%;
    transition: all 0.3s ease;

}

.link-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.link-icon {
    font-size: 28px;
}

.link-icon.blue {
    color: #0689d2;
}

.link-icon.teal {
    color: #14b8a6;

}

.link-icon.purple {
    color: #8b5cf6;
}

.link-icon.orange {
    color: #f97316;
}

.link-label {
    font-size: 1.25rem;
    font-weight: bold;
    color: #1e293b;
}

.link-arrow {
    font-size: 24px;
    color: #94a3b8;
    transition: transform 0.2s ease;
}

.access-link:hover .link-arrow {
    transform: translateX(8px);
}

.admin-only {
    display: none;
}

/* Settings Section */
.settings-section {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-bottom: 16px;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.setting-item,
.setting-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    padding-right: 16px;
    border-bottom: 1px solid #f1f5f9;
    font-family: inherit;

}

.setting-button {
    background: none;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s ease;
}

.setting-button:hover {
    background: #f8fafc;
}

.setting-item:last-child,
.setting-button:last-child {
    border-bottom: none;
}

.setting-item.disabled {
    opacity: 0.5;
}

.setting-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.setting-icon {
    font-size: 24px;
    color: #3b82f6;
}

.logout-button .setting-icon {
    color: #ef4444;
}

.logout-button .setting-label {
    color: #ef4444;
}

.setting-label {
    font-size: 1rem;
    font-weight: 500;
    color: #1e293b;
}

.setting-arrow {
    font-size: 20px;
    color: #94a3b8;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 31px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 2px;
    top: 2px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.toggle-slider {
    background-color: #3b82f6;
}

input:checked+.toggle-slider:before {
    transform: translateX(30px);
}

input:disabled+.toggle-slider {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 32px 0;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.footer-link {
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: #1e40af;
    text-decoration: underline;
}

.footer-divider {
    color: #cbd5e1;
    font-size: 0.875rem;
}

.footer-version {
    font-size: 0.8125rem;
    color: #94a3b8;
    font-weight: 400;
}

/* Dialog Styles */
dialog {
    padding: 0;
    border: none;
    border-radius: 16px;
    max-width: 420px;
    width: 90vw;
    background-color: white;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    margin: auto;
}

dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
}

.dialog-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.dialog-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.dialog-close:hover {
    background: #f8fafc;
}

.dialog-close .material-symbols-outlined {
    font-size: 24px;
    color: #64748b;
}

.dialog-content {
    padding: 24px;
}

/* on mobile */
@media (max-width: 480px) {
    .dialog-content {
        padding: 0;
        padding-top: 8px;
    }
}



/* Account Dialog */
.account-info {
    margin-bottom: 24px;
}

.account-detail {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

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

.account-label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.account-value {
    font-size: 1rem;
    color: #1e293b;
    font-weight: 600;
}

.account-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-btn {
    padding: 14px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    color: #1e293b;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.action-btn:hover {
    background: #f8fafc;
    border-color: #3b82f6;
}

.action-btn .material-symbols-outlined {
    font-size: 20px;
}

.logout-btn {
    border-color: #ef4444;
    color: #ef4444;
}

.logout-btn:hover {
    background: #fef2f2;
    border-color: #dc2626;
}

/* App Required Dialog */
.app-required-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
}

.warning-icon {
    font-size: 64px;
    color: #f59e0b;
}

.app-required-content p {
    font-size: 1rem;
    color: #64748b;
    line-height: 1.6;
}

/* Welcome Dialog */
.welcome-content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 16px;
}

.welcome-content p {
    font-size: 1.125rem;
    color: #1e293b;
    font-weight: 500;
    margin-bottom: 8px;
}

.help-btn-header {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
}

.help-btn-header:hover {
    background: rgba(255, 255, 255, 0.3);
}

.help-btn-header .material-symbols-outlined {
    font-size: 24px;
    color: #3b82f6;
}

#welcome-login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#welcome-login-form label {
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: -8px;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon input {
    flex: 1;
    padding-right: 48px;
}

.input-help-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.input-help-btn:hover {
    background: #f1f5f9;
}

.input-help-btn .material-symbols-outlined {
    font-size: 20px;
    color: #64748b;
}

#welcome-login-form input,
#welcome-login-form select {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    font-family: inherit;
    width: 100%;
}

#welcome-login-form input:focus,
#welcome-login-form select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#welcome-login-form input::placeholder {
    color: #94a3b8;
}

#welcome-login-btn {
    margin-top: 8px;
}

#welcome-login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.dialog-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.primary-btn {
    padding: 12px 32px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.primary-btn:hover {
    background: #1e40af;
}

.secondary-btn {
    padding: 12px 32px;
    background: white;
    color: #3b82f6;
    border: 2px solid #3b82f6;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: #f0f8ff;
}

.bottom-waves {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: auto;
    z-index: -1;
    opacity: 0.7;
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .bottom-waves {
        display: block;
    }

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

    .greeting-text {
        font-size: 1.75rem;
    }

    .welcome-subtitle {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .welcome-section {
        padding: 32px 0 16px;
    }

    .greeting-text {
        font-size: 1.5rem;
    }

    .welcome-subtitle {
        font-size: 0.9375rem;
    }

    .access-card {
        padding: 20px 16px;
    }

    .card-icon-wrapper {
        width: 48px;
        height: 48px;
    }

    .card-icon-wrapper .material-symbols-outlined {
        font-size: 28px;
    }

    .access-card h4 {
        font-size: 1rem;
    }

    .settings-section {
        padding: 20px;
    }

    .app-header {
        border-radius: 0 0 8px 8px;
        min-height: 110px;
    }
}

/* Login Success Dialog */
.login-success-dialog {
    border: none;
    border-radius: 24px;
    padding: 0;
    max-width: 360px;
    width: 90vw;
    background: white;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.login-success-dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.success-content {
    padding: 48px 32px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.success-icon {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-icon .material-symbols-outlined {
    font-size: 72px;
    color: white;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 48;
}

.success-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeInModule {
    from {
        opacity: 0;
        scale: 0.95;
    }
    to {
        opacity: 1;
        scale: 1;
    }
}

#welcome-dialog {
    min-height: 480px;
    max-width:  650px;
}

/* Custom PIN Dialog */
.custom-pin-dialog {
    border: none;
    border-radius: 24px;
    padding: 0;
    max-width: 440px;
    width: 90vw;
    background: white;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
}

.custom-pin-dialog::backdrop {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
}

.custom-pin-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(100, 116, 139, 0.1);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.custom-pin-close:hover {
    background: rgba(100, 116, 139, 0.2);
    transform: scale(1.1);
}

.custom-pin-close .material-symbols-outlined {
    font-size: 24px;
    color: #64748b;
}

.custom-pin-content {
    padding: 48px 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.custom-pin-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
}

.custom-pin-icon .material-symbols-outlined {
    font-size: 56px;
    color: white;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 48;
}

.custom-pin-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 12px 0;
    letter-spacing: -0.5px;
}

.custom-pin-subtitle {
    font-size: 1rem;
    color: #64748b;
    margin: 0 0 40px 0;
    line-height: 1.5;
}

#custom-pin-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.custom-pin-input-wrapper {
    width: 100%;
    max-width: 300px;
}

#custom-pin-input {
    width: 100%;
    padding: 20px 24px;
    border: 3px solid #e2e8f0;
    border-radius: 16px;
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 16px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    transition: all 0.3s ease;
    background: #f8fafc;
    color: #1e293b;
}

#custom-pin-input::placeholder {
    color: #cbd5e1;
    font-weight: 400;
    letter-spacing: 20px;
}

#custom-pin-input:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 8px 24px rgba(59, 130, 246, 0.15);
    transform: scale(1.02);
}

.custom-pin-submit-btn {
    width: 100%;
    max-width: 300px;
    padding: 16px 32px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.custom-pin-submit-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    box-shadow: 0 6px 24px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

.custom-pin-submit-btn:active {
    transform: translateY(0);
}

.custom-pin-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.custom-pin-submit-btn .material-symbols-outlined {
    font-size: 24px;
    transition: transform 0.3s ease;
}

.custom-pin-submit-btn:hover .material-symbols-outlined {
    transform: translateX(4px);
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .custom-pin-content {
        padding: 40px 24px;
    }

    .custom-pin-icon {
        width: 80px;
        height: 80px;
        margin-bottom: 20px;
    }

    .custom-pin-icon .material-symbols-outlined {
        font-size: 48px;
    }

    .custom-pin-title {
        font-size: 1.5rem;
    }

    .custom-pin-subtitle {
        font-size: 0.9375rem;
        margin-bottom: 32px;
    }

    #custom-pin-input {
        padding: 18px 20px;
        font-size: 2rem;
        letter-spacing: 12px;
    }

    #custom-pin-input::placeholder {
        letter-spacing: 16px;
    }
}