@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --bg-primary: #f3f4f8;
    --bg-secondary: #e9ecf5;
    --bg-tertiary: #f5f1ee;
    
    --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.04);
    
    --color-text-primary: #111827;
    --color-text-secondary: #4b5563;
    --color-text-muted: #9ca3af;
    
    --color-primary: #2563eb;
    --color-success: #10b981;
    --color-error: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100%;
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--color-text-primary);
    overflow: hidden;
}

/* Background Liquid Gradients & Blurry Blobs */
.liquid-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary), var(--bg-tertiary));
    overflow: hidden;
}

.liquid-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 25s infinite alternate ease-in-out;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, rgba(255,255,255,0) 70%);
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 70vw;
    height: 70vw;
    background: radial-gradient(circle, rgba(244, 63, 94, 0.25) 0%, rgba(255,255,255,0) 70%);
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 30%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, rgba(255,255,255,0) 70%);
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
    100% {
        transform: translate(10%, 15%) scale(1.15) rotate(360deg);
    }
}

/* App Shell Layout */
.app-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

/* Glassmorphic Cards & Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    box-shadow: var(--glass-shadow);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.viewport-card {
    width: 100%;
    max-width: 420px;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* View Control */
.view-section {
    display: none;
    width: 100%;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-section.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

/* Logo Layout */
.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 28px;
}

.app-logo {
    width: 90px;
    height: 90px;
    border-radius: 24px;
    object-fit: cover;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.app-title {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-top: 14px;
    letter-spacing: -0.5px;
}

.app-subtitle {
    font-size: 13px;
    font-weight: 400;
    color: var(--color-text-secondary);
    opacity: 0.8;
    margin-top: 4px;
}

.app-domain {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Forms & Input Styling */
.form-group {
    width: 100%;
    margin-bottom: 16px;
    position: relative;
}

.input-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
    padding-left: 4px;
}

.input-container {
    position: relative;
    width: 100%;
}

.glass-input {
    width: 100%;
    padding: 14px 16px;
    padding-right: 46px; /* For password toggle icons */
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    outline: none;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.02);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-input:focus {
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--color-text-secondary);
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    opacity: 1;
}

/* Error Alerts */
.error-banner {
    display: none;
    width: 100%;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 14px;
    color: var(--color-error);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 18px;
    text-align: center;
    box-sizing: border-box;
}

.error-banner.active {
    display: block;
    animation: shake 0.4s ease-in-out;
}

/* Submit Action Button */
.btn-submit {
    width: 100%;
    padding: 14px;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 4px 15px -3px rgba(37, 99, 235, 0.3);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-submit:active {
    transform: scale(0.97);
    filter: brightness(0.9);
}

.btn-submit:disabled {
    background: var(--color-text-muted);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Spinner Loader */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    display: none;
}

.loading .spinner {
    display: inline-block;
}

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

/* PIN View Specific Styles */
.pin-top-bar {
    width: 100%;
    max-width: 420px;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-radius: 20px;
}

.tenant-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tenant-status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--color-success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--color-success);
    animation: pulse 1.8s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    100% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 12px var(--color-success); }
}

.tenant-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.btn-logout-restaurant {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    background: none;
    border: none;
    outline: none;
    transition: color 0.2s;
}

.btn-logout-restaurant:hover {
    color: var(--color-error);
}

/* PIN Input Dots */
.pin-dots-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 24px 0;
}

.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-dot.filled {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #374151, #111827);
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(17, 24, 39, 0.3);
}

.pin-dot.error {
    background: linear-gradient(135deg, #f87171, #dc2626);
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.3);
}

/* Keypad Grid for PIN */
.keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 14px;
    width: 100%;
    max-width: 280px;
}

.keypad-btn {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 500;
    color: var(--color-text-primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.keypad-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

.keypad-btn.action-btn {
    background: none;
    border: none;
    box-shadow: none;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.keypad-btn.action-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.92);
}

.keypad-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* Shake Animation on Error */
.shaking {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15%, 45%, 75% { transform: translateX(-8px); }
    30%, 60%, 90% { transform: translateX(8px); }
}

/* Success View Overlay */
.success-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: scaleUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.success-icon-wrap {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.12);
    border: 2px solid rgba(16, 185, 129, 0.3);
    color: var(--color-success);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.1);
}

.success-icon-wrap svg {
    width: 36px;
    height: 36px;
}

.success-text {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text-primary);
}

.success-sub {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-top: 6px;
}

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

/* Terms and footer links */
.footer-links {
    margin-top: 24px;
    text-align: center;
    font-size: 11px;
    color: var(--color-text-muted);
    line-height: 1.6;
}

.footer-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-weight: 500;
}

.footer-link:hover {
    text-decoration: underline;
}

.app-version {
    margin-top: 14px;
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.3);
    padding: 3px 8px;
    border-radius: 20px;
    border: 1.5px solid rgba(255, 255, 255, 0.5);
}

/* Responsive Overrides */
@media (max-width: 480px) {
    .viewport-card {
        border-radius: 24px;
        padding: 24px 18px;
        box-shadow: none;
        border: 1px solid rgba(255, 255, 255, 0.3);
        background: rgba(255, 255, 255, 0.3);
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 9999;
    max-width: 90%;
    width: 340px;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-container.active {
    transform: translateX(-50%) translateY(0);
}

.toast-content {
    background: rgba(17, 24, 39, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 18px;
    border-radius: 18px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
}

.toast-content.toast-error {
    background: rgba(220, 38, 38, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
}

.toast-content svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}
