/**
 * UltimatePOS Dedicated Lockscreen Styles
 * Modern, minimal design distinct from login page
 * Supports dark mode with CSS variables
 */

/* CSS Variables for Theme Support */
:root {
    /* Default Dark Theme Variables */
    --lockscreen-bg: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 20, 40, 0.95) 100%);
    --lockscreen-card-bg: rgba(255, 255, 255, 0.05);
    --lockscreen-card-border: rgba(255, 255, 255, 0.1);
    --lockscreen-text-primary: rgba(255, 255, 255, 0.95);
    --lockscreen-text-secondary: rgba(255, 255, 255, 0.7);
    --lockscreen-text-muted: rgba(255, 255, 255, 0.5);
    --lockscreen-input-bg: rgba(255, 255, 255, 0.08);
    --lockscreen-input-border: rgba(255, 255, 255, 0.15);
    --lockscreen-input-focus: rgba(0, 122, 255, 0.3);
    --lockscreen-button-bg: rgba(0, 122, 255, 0.8);
    --lockscreen-button-hover: rgba(0, 122, 255, 1);
    --lockscreen-shadow: rgba(0, 0, 0, 0.3);
    --lockscreen-profile-shadow: rgba(0, 0, 0, 0.2);
    --lockscreen-success: #34C759;
    --lockscreen-error: #FF3B30;
    --lockscreen-warning: #FF9500;
}

/* Light Theme Variables */
[data-theme="light"] {
    --lockscreen-bg: linear-gradient(135deg, rgba(240, 240, 250, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
    --lockscreen-card-bg: rgba(255, 255, 255, 0.9);
    --lockscreen-card-border: rgba(0, 0, 0, 0.1);
    --lockscreen-text-primary: rgba(0, 0, 0, 0.9);
    --lockscreen-text-secondary: rgba(0, 0, 0, 0.7);
    --lockscreen-text-muted: rgba(0, 0, 0, 0.5);
    --lockscreen-input-bg: rgba(255, 255, 255, 0.8);
    --lockscreen-input-border: rgba(0, 0, 0, 0.15);
    --lockscreen-input-focus: rgba(0, 122, 255, 0.2);
    --lockscreen-button-bg: rgba(0, 122, 255, 0.9);
    --lockscreen-button-hover: rgba(0, 122, 255, 1);
    --lockscreen-shadow: rgba(0, 0, 0, 0.1);
    --lockscreen-profile-shadow: rgba(0, 0, 0, 0.1);
    --lockscreen-success: #34C759;
    --lockscreen-error: #FF3B30;
    --lockscreen-warning: #FF9500;
}

/* Base Lockscreen Layout */
.lockscreen-container,
.auth-lockscreen-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: var(--lockscreen-bg) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
    overflow: hidden !important;
    z-index: 999999 !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

/* Ensure lockscreen container allows interaction when active */
.lockscreen-container.active,
.auth-lockscreen-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Force pointer events on lockscreen elements */
.lockscreen-container .lockscreen-card,
.lockscreen-container .lockscreen-form,
.lockscreen-container .lockscreen-input-group,
.lockscreen-container .lockscreen-input,
.lockscreen-container .lockscreen-unlock-btn {
    pointer-events: auto !important;
}

/* Lockscreen Card */
.lockscreen-card,
.auth-lockscreen-overlay .auth-card {
    background: var(--lockscreen-card-bg);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid var(--lockscreen-card-border);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    box-shadow: 
        0 32px 64px var(--lockscreen-shadow),
        0 0 0 1px var(--lockscreen-card-border),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    max-width: 420px;
    width: 90%;
    text-align: center;
    position: relative;
    animation: lockscreenSlideIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes lockscreenSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Date and Time Section */
.lockscreen-datetime {
    margin-bottom: 2.5rem;
}

.lockscreen-time {
    font-size: 3.5rem;
    font-weight: 200;
    color: var(--lockscreen-text-primary);
    margin-bottom: 0.5rem;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    letter-spacing: -0.02em;
    line-height: 1;
}

.lockscreen-date {
    font-size: 1.1rem;
    color: var(--lockscreen-text-secondary);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Profile Section */
.lockscreen-profile {
    margin-bottom: 2.5rem;
}

.lockscreen-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    overflow: hidden;
    box-shadow: 
        0 8px 32px var(--lockscreen-profile-shadow),
        0 0 0 3px rgba(255, 255, 255, 0.1);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.lockscreen-avatar:hover {
    transform: scale(1.05);
    box-shadow: 
        0 12px 40px var(--lockscreen-profile-shadow),
        0 0 0 3px rgba(255, 255, 255, 0.2);
}

.lockscreen-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lockscreen-avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.8), rgba(88, 86, 214, 0.8));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
}

.lockscreen-username {
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--lockscreen-text-primary);
    margin-bottom: 0.25rem;
}

.lockscreen-user-role {
    font-size: 0.9rem;
    color: var(--lockscreen-text-muted);
    font-weight: 400;
}

/* Form Section */
.lockscreen-form {
    margin-bottom: 2rem;
}

.lockscreen-input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.lockscreen-input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--lockscreen-input-bg);
    border: 1px solid var(--lockscreen-input-border);
    border-radius: 16px;
    color: var(--lockscreen-text-primary);
    font-size: 1rem;
    font-weight: 400;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lockscreen-input::placeholder {
    color: var(--lockscreen-text-muted);
}

.lockscreen-input:focus {
    outline: none;
    border-color: var(--lockscreen-input-focus);
    box-shadow: 0 0 0 3px var(--lockscreen-input-focus);
    background: var(--lockscreen-input-bg);
}

.lockscreen-input:focus::placeholder {
    color: var(--lockscreen-text-secondary);
}

/* Unlock Button */
.lockscreen-unlock-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: var(--lockscreen-button-bg);
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.lockscreen-unlock-btn:hover {
    background: var(--lockscreen-button-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 122, 255, 0.3);
}

.lockscreen-unlock-btn:active {
    transform: translateY(0);
}

.lockscreen-unlock-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.lockscreen-unlock-btn .loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

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

/* Switch Account Link */
.lockscreen-switch-account {
    color: var(--lockscreen-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 400;
    transition: color 0.3s ease;
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.lockscreen-switch-account:hover {
    color: var(--lockscreen-text-secondary);
    background: rgba(255, 255, 255, 0.05);
    text-decoration: none;
}

/* Toast Notifications */
.lockscreen-toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--lockscreen-card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--lockscreen-card-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    color: var(--lockscreen-text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 8px 32px var(--lockscreen-shadow);
    z-index: 10000;
    animation: toastSlideIn 0.3s ease-out;
    max-width: 300px;
}

.lockscreen-toast.success {
    border-left: 4px solid var(--lockscreen-success);
}

.lockscreen-toast.error {
    border-left: 4px solid var(--lockscreen-error);
}

.lockscreen-toast.warning {
    border-left: 4px solid var(--lockscreen-warning);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .lockscreen-card {
        padding: 2rem 1.5rem;
        max-width: 90%;
        margin: 1rem;
    }
    
    .lockscreen-time {
        font-size: 2.8rem;
    }
    
    .lockscreen-date {
        font-size: 1rem;
    }
    
    .lockscreen-avatar {
        width: 70px;
        height: 70px;
    }
    
    .lockscreen-username {
        font-size: 1.2rem;
    }
    
    .lockscreen-toast {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .lockscreen-card {
        padding: 1.5rem 1rem;
        border-radius: 20px;
    }
    
    .lockscreen-time {
        font-size: 2.4rem;
    }
    
    .lockscreen-date {
        font-size: 0.9rem;
    }
    
    .lockscreen-avatar {
        width: 60px;
        height: 60px;
    }
    
    .lockscreen-username {
        font-size: 1.1rem;
    }
    
    .lockscreen-input {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }
    
    .lockscreen-unlock-btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .lockscreen-card {
        border: 2px solid var(--lockscreen-card-border);
    }
    
    .lockscreen-input {
        border: 2px solid var(--lockscreen-input-border);
    }
    
    .lockscreen-unlock-btn {
        border: 2px solid var(--lockscreen-button-bg);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .lockscreen-card {
        animation: none;
    }
    
    .lockscreen-avatar {
        transition: none;
    }
    
    .lockscreen-unlock-btn {
        transition: none;
    }
    
    .lockscreen-toast {
        animation: none;
    }
}

/* Focus styles for accessibility */
.lockscreen-unlock-btn:focus,
.lockscreen-switch-account:focus {
    outline: 2px solid var(--lockscreen-input-focus);
    outline-offset: 2px;
}

/* Loading state */
.lockscreen-loading {
    pointer-events: none;
    opacity: 0.7;
}

.lockscreen-loading .lockscreen-unlock-btn {
    cursor: not-allowed;
}
