/* ============================================
   LOGIN SCREEN STYLES
   ============================================ */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.login-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.login-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    margin: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    animation: slideInUp 0.5s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    margin-bottom: 20px;
}

.logo-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin: 0 0 8px 0;
}

.login-header p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.login-form {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.company-selector {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.2s ease;
    font-size: 16px;
}

.company-selector:hover {
    border-color: #667eea;
}

.company-selector.selected {
    border-color: #667eea;
    color: #333;
}

.company-selector .chevron {
    color: #999;
    font-size: 12px;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.login-debug {
    text-align: center;
    font-size: 12px;
    color: #666;
    border-top: 1px solid #e1e5e9;
    padding-top: 20px;
}

.login-debug p {
    margin: 4px 0;
}

.debug-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
}

.btn-debug {
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 16px;
    font-size: 11px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-debug:hover {
    background: #e9ecef;
}

/* Login footer styles */
.login-footer {
    margin-top: 30px;
    text-align: center;
}

.register-text {
    font-size: 14px;
    color: #6B7280;
    margin-bottom: 12px;
}

.btn-register-link {
    background: none;
    border: none;
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.btn-register-link:hover {
    color: #764ba2;
}

/* Register screen styles */
.register-container {
    max-width: 450px;
}

.register-form {
    max-height: 65vh;
    overflow-y: auto;
    padding-right: 5px;
}

.register-form::-webkit-scrollbar {
    width: 4px;
}

.register-form::-webkit-scrollbar-track {
    background: transparent;
}

.register-form::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 10px;
}

.register-form::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

.form-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #E5E7EB;
}

.required {
    color: #EF4444;
    margin-left: 2px;
    font-size: 14px;
}

.register-info {
    font-size: 11px;
    color: #6B7280;
    line-height: 1.4;
}

.register-info .link {
    color: #667eea;
    text-decoration: none;
}

.register-info .link:hover {
    text-decoration: underline;
}

.btn-back {
    position: absolute;
    top: 20px;
    left: 20px;
    background: none;
    border: none;
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.btn-back:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* Dark mode styles for login */
@media (prefers-color-scheme: dark) {
    .login-container {
        background: #1F2937;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    }

    .login-header h1 {
        color: #F9FAFB;
    }

    .login-header p {
        color: #9CA3AF;
    }

    .form-group label {
        color: #F9FAFB;
    }

    .form-group input {
        background: #374151;
        border-color: #4B5563;
        color: #F9FAFB;
    }

    .form-group input:focus {
        border-color: #667eea;
    }

    .company-selector {
        background: #374151;
        border-color: #4B5563;
        color: #9CA3AF;
    }

    .company-selector.selected {
        border-color: #667eea;
        color: #F9FAFB;
    }

    .login-debug {
        color: #9CA3AF;
        border-top-color: #4B5563;
    }

    .btn-debug {
        background: #374151;
        border-color: #4B5563;
        color: #F9FAFB;
    }

    .btn-debug:hover {
        background: #4B5563;
    }

    .register-text {
        color: #9CA3AF;
    }

    .btn-register-link {
        color: #818CF8;
    }

    .btn-register-link:hover {
        color: #A5B4FC;
    }

    .section-title {
        color: #F9FAFB;
        border-bottom-color: #4B5563;
    }

    .register-info {
        color: #9CA3AF;
    }

    .register-info .link {
        color: #818CF8;
    }

    .register-info .link:hover {
        color: #A5B4FC;
    }

    .btn-back {
        color: #818CF8;
    }

    .btn-back:hover {
        background: rgba(129, 140, 248, 0.1);
    }

    .register-form::-webkit-scrollbar-track {
        background: transparent;
    }

    .register-form::-webkit-scrollbar-thumb {
        background: rgba(129, 140, 248, 0.3);
    }

    .register-form::-webkit-scrollbar-thumb:hover {
        background: rgba(129, 140, 248, 0.5);
    }
}

/* Error message */
.error-message {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}

/* Company modal */
.company-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.company-modal.show {
    opacity: 1;
    visibility: visible;
}

.company-modal-content {
    background: var(--bg-surface, #fff);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: slideInUp 0.3s ease;
}

.company-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.company-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary, #333);
}

.btn-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary, #666);
    padding: 4px;
}

.company-search {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.company-search input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

.company-search input:focus {
    outline: none;
    border-color: #667eea;
}

.company-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.company-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #f0f0f0);
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.company-item:hover {
    background: var(--bg-surface-variant, #f8f9fa);
}

.company-item.selected {
    background: #e3f2fd;
}

.company-name {
    font-weight: 600;
    color: var(--text-primary, #333);
    margin-bottom: 0;
}

.company-code {
    font-size: 12px;
    color: var(--text-secondary, #666);
}

.company-loading,
.company-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary, #666);
}

/* Dark mode styles for company modal */
@media (prefers-color-scheme: dark) {
    .company-modal-content {
        background: #1F2937;
    }

    .company-modal-header {
        border-bottom-color: #4B5563;
    }

    .company-modal-header h3 {
        color: #F9FAFB;
    }

    .btn-close {
        color: #9CA3AF;
    }

    .btn-close:hover {
        color: #F9FAFB;
    }

    .company-search {
        border-bottom-color: #4B5563;
    }

    .company-search input {
        background: #374151;
        border-color: #4B5563;
        color: #F9FAFB;
    }

    .company-item {
        border-bottom-color: #374151;
    }

    .company-item:hover {
        background: #374151;
    }

    .company-name {
        color: #F9FAFB;
    }

    .company-code {
        color: #9CA3AF;
    }

    .company-loading {
        color: #9CA3AF;
    }
}

/* Responsive login */
@media (max-width: 480px) {
    .login-container {
        margin: 10px;
        padding: 30px 20px;
    }

    .login-header h1 {
        font-size: 24px;
    }

    .logo-icon {
        font-size: 50px;
    }
}
