/* ============================================
   SIPD Penatausahaan - Login Page Styles
   ============================================ */

:root {
    --primary: #1a3a6b;
    --primary-dark: #0f2444;
    --primary-light: #2c5aa0;
    --secondary: #c0392b;
    --gold: #d4a843;
    --gold-light: #f0d68a;
    --bg-main: #e8ecf1;
    --bg-card: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #5a6c7d;
    --text-muted: #9098a5;
    --border: #dce3ea;
    --border-focus: #1a3a6b;
    --danger: #e74c3c;
    --warning: #f39c12;
    --warning-bg: #fef9e7;
    --success: #27ae60;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.18);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0d1f3c 0%, #1a3a6b 40%, #1a5276 70%, #1a3a6b 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
}

/* Background Pattern */
.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(ellipse at 20% 50%, rgba(255, 255, 255, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 255, 255, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(255, 255, 255, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Grid pattern subtle */
.bg-pattern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* ============================================
   Main Container
   ============================================ */
.main-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    padding: 20px;
}

/* ============================================
   Header Banner
   ============================================ */
.header-banner {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 20px 30px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.header-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    border-radius: 50%;
}

.header-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold));
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.header-text h1 {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 1.5px;
    margin-bottom: 2px;
}

.header-text h2 {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 2px;
}

/* Logo containers */
.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-polban {
    width: 58px;
    height: 58px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.logo-polban-right {
    width: 52px;
    height: 52px;
    opacity: 0.95;
}

/* ============================================
   Login Panel
   ============================================ */
.login-panel {
    background: var(--bg-card);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.panel-header {
    background: var(--primary);
    padding: 14px 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
}

.panel-header i {
    font-size: 18px;
    color: var(--gold-light);
}

.panel-body {
    padding: 30px;
}

/* ============================================
   Alert
   ============================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 13px;
    line-height: 1.5;
}

.alert i {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-warning {
    background: var(--warning-bg);
    border: 1px solid #f9e79f;
    color: #7d6608;
}

.alert-warning i {
    color: var(--warning);
}

/* ============================================
   Form Styles
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 7px;
}

.form-group label i {
    color: var(--primary);
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
    color: var(--text-primary);
    transition: all var(--transition);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(26, 58, 107, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a6c7d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

/* ============================================
   Password Wrapper
   ============================================ */
.password-wrapper {
    position: relative;
}

.password-wrapper .form-control {
    padding-right: 50px;
}

.toggle-password {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px;
    font-size: 16px;
    transition: color var(--transition);
    z-index: 2;
}

.toggle-password:hover {
    color: var(--primary);
}

/* ============================================
   Captcha
   ============================================ */
.captcha-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.captcha-box {
    position: relative;
    flex-shrink: 0;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--border);
}

.captcha-box canvas {
    display: block;
    cursor: pointer;
}

.refresh-captcha {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--primary);
    cursor: pointer;
    font-size: 15px;
    transition: all var(--transition);
}

.refresh-captcha:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.captcha-input {
    flex: 1;
}

/* ============================================
   Login Button
   ============================================ */
.btn-login {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 58, 107, 0.35);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(26, 58, 107, 0.3);
}

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

/* ============================================
   Loading
   ============================================ */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 15px;
    color: var(--text-secondary);
    font-size: 14px;
}

.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   Panel Footer
   ============================================ */
.panel-footer {
    border-top: 1px solid var(--border);
    padding: 20px 30px;
    text-align: center;
    background: #fafbfc;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.footer-links a:hover {
    background: rgba(26, 58, 107, 0.08);
    color: var(--primary-dark);
}

.footer-links .separator {
    color: var(--text-muted);
    font-size: 13px;
}

.footer-text p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ============================================
   Toast Notification
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    max-width: 420px;
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

.toast-warning {
    background: var(--warning);
}

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

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

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 576px) {
    .main-container {
        padding: 12px;
    }

    .header-banner {
        padding: 16px 20px;
        border-radius: var(--radius) var(--radius) 0 0;
    }

    .header-text h1 {
        font-size: 12px;
        letter-spacing: 0.8px;
    }

    .header-text h2 {
        font-size: 9px;
    }

    .logo-polban {
        width: 44px;
        height: 44px;
    }

    .logo-polban-right {
        width: 40px;
        height: 40px;
    }

    .header-left {
        gap: 12px;
    }

    .panel-header {
        padding: 12px 20px;
        font-size: 13px;
    }

    .panel-body {
        padding: 20px;
    }

    .panel-footer {
        padding: 16px 20px;
    }

    .captcha-wrapper {
        flex-direction: column;
    }

    .captcha-box {
        width: 100%;
    }

    .captcha-box canvas {
        width: 100%;
        height: auto;
    }

    .footer-links {
        flex-direction: column;
        gap: 8px;
    }

    .footer-links .separator {
        display: none;
    }
}

/* ============================================
   Register Page (Daftar) Styles
   ============================================ */

/* Container lebih lebar untuk form daftar */
.register-container {
    max-width: 680px;
}

/* Form row - 2 kolom */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Pesan error per field */
.field-error {
    display: block;
    font-size: 12px;
    color: var(--danger);
    margin-top: 5px;
    min-height: 16px;
}

/* ============================================
   Password Strength Indicator
   ============================================ */
.password-strength {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.strength-bar {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    transition: background 0.3s ease;
}

.strength-text {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 100px;
    text-align: right;
    font-weight: 500;
}

.password-strength.weak .strength-bar:nth-child(1) {
    background: var(--danger);
}

.password-strength.weak .strength-text {
    color: var(--danger);
}

.password-strength.medium .strength-bar:nth-child(-n + 2) {
    background: var(--warning);
}

.password-strength.medium .strength-text {
    color: var(--warning);
}

.password-strength.strong .strength-bar {
    background: var(--success);
}

.password-strength.strong .strength-text {
    color: var(--success);
}

/* ============================================
   Checkbox (Syarat & Ketentuan)
   ============================================ */
.checkbox-group {
    margin-top: 4px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.5;
}

.checkbox-label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: relative;
    flex-shrink: 0;
    height: 20px;
    width: 20px;
    background: #f8fafc;
    border: 2px solid var(--border);
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-top: 1px;
}

.checkbox-label:hover .checkmark {
    border-color: var(--primary-light);
}

.checkbox-label input:checked ~ .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkmark::after {
    content: '';
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label input:checked ~ .checkmark::after {
    display: block;
}

.terms-text {
    flex: 1;
}

.link-terms {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.link-terms:hover {
    color: var(--primary-light);
}

/* Tombol daftar */
.btn-register {
    background: linear-gradient(135deg, var(--accent, #f58220) 0%, #d46a0e 100%);
}

.btn-register:hover {
    background: linear-gradient(135deg, #ff9a3d 0%, #f58220 100%);
    box-shadow: 0 6px 20px rgba(245, 130, 32, 0.35);
}

/* Link pindah ke login */
.auth-switch {
    text-align: center;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-switch a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-weight: 600;
    margin-left: 6px;
    transition: color 0.2s ease;
}

.auth-switch a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

/* ============================================
   Register - Responsive
   ============================================ */
@media (max-width: 576px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}
