/**
 * Login Page Styles
 * POS BILGISA Corporation
 */

:root {
    --primary: #FF6B35;
    --primary-dark: #E85D2E;
    --secondary: #FFB84D;
    --accent: #F7931E;
    --dark: #2C3E50;
    --light: #FFF8F0;
    --kasir-color: #9B59B6;
    --kasir-dark: #8E44AD;
    --admin-color: #3498DB;
    --admin-dark: #2980B9;
    --success: #27AE60;
    --warning: #F39C12;
    --danger: #E74C3C;
}

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

body {
    font-family: 'Poppins', sans-serif;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    padding: 20px;
}

/* Animated Background */
.bg-shapes {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.bg-shape {
    position: absolute;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.bg-shape:nth-child(1) {
    width: 300px;
    height: 300px;
    top: -150px;
    left: -100px;
}

.bg-shape:nth-child(2) {
    width: 400px;
    height: 400px;
    bottom: -200px;
    right: -150px;
    animation-delay: 2s;
}

.bg-shape:nth-child(3) {
    width: 200px;
    height: 200px;
    top: 50%;
    left: 10%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-30px) rotate(5deg); }
}

/* Login Container */
.login-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: white;
    border-radius: 24px;
    overflow: visible;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    position: relative;
}

/* Header */
.login-header {
    padding: 28px 24px;
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    position: relative;
}

.logo-icon {
    width: 90px;
    height: 90px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 13px;
    opacity: 0.85;
}

/* Tab Switcher */
.tab-switcher {
    display: flex;
    background: #f1f5f9;
    border-radius: 16px;
    padding: 5px;
    margin: -28px 20px 20px;
    position: relative;
    z-index: 2;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.tab-btn {
    flex: 1;
    padding: 14px 16px;
    border: none;
    background: transparent;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #64748b;
}

.tab-btn.active {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.tab-btn.kasir.active {
    color: var(--kasir-color);
}

.tab-btn.admin.active {
    color: var(--admin-color);
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.5);
}

/* Login Body */
.login-body {
    padding: 24px;
    position: relative;
    overflow: visible;
}

.form-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.form-section.active {
    display: block;
}

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

/* Cashier Selector Dropdown */
.cashier-selector {
    position: relative;
    margin-bottom: 20px;
    z-index: 100;
}

.cashier-selector.dropdown-open {
    margin-bottom: 300px; /* Space for dropdown */
}

.cashier-selector-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

.cashier-trigger {
    width: 100%;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.cashier-trigger:hover {
    border-color: #cbd5e1;
    background: white;
}

.cashier-trigger:focus,
.cashier-trigger.open {
    border-color: var(--kasir-color);
    box-shadow: 0 0 0 4px rgba(155, 89, 182, 0.15);
    background: white;
    outline: none;
}

.cashier-trigger .selected-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.cashier-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--kasir-color), var(--kasir-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.cashier-name {
    font-weight: 500;
    color: #1e293b;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cashier-placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.chevron-icon {
    width: 20px;
    height: 20px;
    color: #94a3b8;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.cashier-trigger.open .chevron-icon {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.cashier-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0,0,0,0.05);
    z-index: 9999;
    display: none;
    max-height: 280px;
    overflow: hidden;
}

.cashier-dropdown.show {
    display: block;
    animation: dropdownOpen 0.2s ease;
}

@keyframes dropdownOpen {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.cashier-search {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.cashier-search input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") no-repeat 10px center;
    background-size: 18px;
    transition: all 0.2s;
}

.cashier-search input:focus {
    outline: none;
    border-color: var(--kasir-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}

.cashier-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
}

.cashier-list::-webkit-scrollbar {
    width: 6px;
}

.cashier-list::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.cashier-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.cashier-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cashier-item:hover {
    background: #f1f5f9;
}

.cashier-item.selected {
    background: rgba(155, 89, 182, 0.1);
}

.cashier-item .check-icon {
    margin-left: auto;
    color: var(--kasir-color);
    opacity: 0;
}

.cashier-item.selected .check-icon {
    opacity: 1;
}

.no-cashiers {
    padding: 30px 20px;
    text-align: center;
    color: #94a3b8;
}

.no-cashiers i {
    font-size: 40px;
    margin-bottom: 10px;
    display: block;
}

/* PIN Input */
.pin-section {
    margin-top: 24px;
}

.pin-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 12px;
    text-align: center;
}

.pin-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}

.pin-digit {
    width: 50px;
    height: 60px;
    font-size: 24px;
    font-weight: 700;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    text-align: center;
    transition: all 0.2s ease;
    background: #f8fafc;
    color: #1e293b;
}

.pin-digit:focus {
    border-color: var(--kasir-color);
    box-shadow: 0 0 0 4px rgba(155, 89, 182, 0.15);
    outline: none;
    background: white;
}

.pin-digit.filled {
    border-color: var(--kasir-color);
    background: white;
}

.pin-digit.error {
    border-color: var(--danger);
    background: #fef2f2;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Form Controls */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 18px;
    z-index: 1;
}

.form-control {
    width: 100%;
    height: 52px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    padding: 0 16px 0 46px;
    font-size: 15px;
    background: #f8fafc;
    transition: all 0.2s ease;
    color: #1e293b;
}

.form-control:hover {
    border-color: #cbd5e1;
}

.form-control:focus {
    border-color: var(--admin-color);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.15);
    background: white;
    outline: none;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    z-index: 1;
}

.password-toggle:hover {
    color: #64748b;
}

/* Buttons */
.btn-login {
    width: 100%;
    height: 54px;
    border-radius: 14px;
    border: none;
    color: white;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login.kasir {
    background: linear-gradient(135deg, var(--kasir-color), var(--kasir-dark));
    box-shadow: 0 8px 20px rgba(155, 89, 182, 0.35);
}

.btn-login.admin {
    background: linear-gradient(135deg, var(--admin-color), var(--admin-dark));
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.35);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

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

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Alerts */
.alert {
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    border: none;
}

.alert-danger {
    background: #fef2f2;
    color: #dc2626;
}

.alert-warning {
    background: #fffbeb;
    color: #d97706;
}

.lock-warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-left: 4px solid #f59e0b;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 18px;
}

.lock-warning i {
    color: #f59e0b;
    font-size: 24px;
}

/* Help Text */
.help-text {
    text-align: center;
    margin-top: 16px;
    color: #94a3b8;
    font-size: 13px;
}

.help-text i {
    margin-right: 4px;
}

/* Modal Styles */
.modal-content {
    border-radius: 20px;
    border: none;
    overflow: hidden;
}

.modal-header-custom {
    background: linear-gradient(135deg, #27AE60, #219A52);
    color: white;
    padding: 20px 24px;
}

.modal-body-custom {
    padding: 24px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive - Tablet */
@media (min-width: 768px) and (max-width: 1024px) {
    body {
        padding: 40px;
    }

    .login-container {
        max-width: 480px;
    }

    .login-header {
        padding: 36px 32px;
    }

    .logo-icon {
        width: 100px;
        height: 100px;
    }

    .brand-name {
        font-size: 26px;
    }

    .login-body {
        padding: 32px;
    }

    .pin-digit {
        width: 56px;
        height: 68px;
        font-size: 28px;
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    body {
        padding: 12px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .login-card {
        border-radius: 20px;
    }

    .login-header {
        padding: 24px 20px;
    }

    .logo-icon {
        width: 75px;
        height: 75px;
    }

    .brand-name {
        font-size: 20px;
    }

    .brand-subtitle {
        font-size: 12px;
    }

    .tab-switcher {
        margin: -24px 16px 16px;
        padding: 4px;
    }

    .tab-btn {
        padding: 12px 10px;
        font-size: 13px;
        gap: 6px;
    }

    .tab-btn i {
        font-size: 16px;
    }

    .login-body {
        padding: 20px 16px;
    }

    .pin-container {
        gap: 8px;
    }

    .pin-digit {
        width: 44px;
        height: 54px;
        font-size: 22px;
        border-radius: 10px;
    }

    .cashier-trigger {
        padding: 12px 14px;
    }

    .cashier-avatar {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }

    .form-control {
        height: 50px;
        font-size: 14px;
    }

    .btn-login {
        height: 52px;
        font-size: 14px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .pin-digit {
        width: 40px;
        height: 50px;
        font-size: 20px;
    }

    .tab-btn span {
        display: none;
    }

    .tab-btn i {
        font-size: 20px;
    }
}
