/* =====================================================
   Authentication Pages Styles
   YouTube Logger - Dark Theme
   ===================================================== */

/* Utility */
.inline-form { display: inline; }
.auth-message-detail { text-align: left; margin-bottom: 2rem; }

/* Login/Change Password Container */
.auth-container {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: var(--card-bg, rgba(30, 30, 40, 0.95));
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.auth-card.wide {
    max-width: 500px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 1.75rem;
    margin: 0;
    color: var(--text-primary, #fff);
}

.auth-header .icon {
    font-size: 3rem;
    color: #ff0000;
    margin-bottom: 1rem;
}

.auth-header .subtitle {
    color: var(--text-secondary, #aaa);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Form Elements */
.auth-form .form-group {
    margin-bottom: 1.25rem;
}

.auth-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary, #ccc);
    font-size: 0.9rem;
    font-weight: 500;
}

.auth-form .form-group input[type="text"],
.auth-form .form-group input[type="password"] {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--text-primary, #fff);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.auth-form .form-group input:focus-visible {
    border-color: var(--color-accent-primary);
    outline: 2px solid var(--color-accent-primary);
    outline-offset: 2px;
    box-shadow: none;
}

.auth-form .form-group input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Checkbox group */
.form-group-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.form-group-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #ff4444;
    cursor: pointer;
}

.form-group-checkbox label {
    margin: 0;
    cursor: pointer;
    color: var(--text-secondary, #ccc);
    font-size: 0.9rem;
}

/* Buttons */
.btn-auth {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #ff4444, #cc0000);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-auth:focus-visible {
    outline: 2px solid var(--color-accent-primary);
    outline-offset: 2px;
}

.btn-auth:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.4);
}

.btn-auth:active:not(:disabled) {
    transform: translateY(0);
}

.btn-auth:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-auth.btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary, #fff);
}

.btn-auth.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: none;
}

/* Messages */
.auth-message {
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.auth-message i {
    flex-shrink: 0;
    margin-top: 2px;
}

.auth-message.error {
    background: rgba(255, 68, 68, 0.15);
    border: 1px solid rgba(255, 68, 68, 0.3);
    color: #ff6b6b;
}

.auth-message.info {
    background: rgba(68, 136, 255, 0.15);
    border: 1px solid rgba(68, 136, 255, 0.3);
    color: #6bb3ff;
}

.auth-message.success {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #81c784;
}

.auth-message.warning {
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #ffc107;
}

.auth-message ul {
    margin: 0.5rem 0 0 1rem;
    padding: 0;
}

.auth-message li {
    margin-bottom: 0.25rem;
}

/* Lockout timer */
.lockout-timer {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #ff6b6b;
}

/* Error Pages (401, 403) */
.error-page {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.error-card {
    background: var(--card-bg, rgba(30, 30, 40, 0.95));
    border-radius: 16px;
    padding: 3rem;
    width: 100%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.error-card .error-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
}

.error-card .error-icon.error-401 {
    color: #ffc107;
}

.error-card .error-icon.error-403 {
    color: #ff4444;
}

.error-card .error-icon.error-404 {
    color: #6bb3ff;  /* 青系 — ページ未発見 */
}

.error-card .error-icon.error-500 {
    color: #ff6b6b;  /* 赤系 — サーバーエラー */
}

.error-card h1 {
    font-size: 2rem;
    color: var(--text-primary, #fff);
    margin: 0 0 0.5rem 0;
}

.error-card .error-code {
    font-size: 1rem;
    color: var(--text-secondary, #888);
    margin-bottom: 1.5rem;
}

.error-card p {
    color: var(--text-secondary, #aaa);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.error-actions .btn {
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.error-actions .btn:hover {
    transform: translateY(-2px);
}

.error-actions .btn-primary {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: #fff;
    border: none;
}

.error-actions .btn-secondary {
    background: transparent;
    color: var(--text-primary, #fff);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Auth Header Component */
.auth-header-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.auth-header-bar .user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary, #aaa);
    font-size: 0.9rem;
}

.auth-header-bar .user-info .username {
    color: var(--text-primary, #fff);
    font-weight: 500;
}

.auth-header-bar .user-info .badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 0.25rem;
}

.auth-header-bar .user-info .badge-root {
    background: rgba(255, 68, 68, 0.2);
    color: #ff6b6b;
}

.auth-header-bar .user-info .badge-admin {
    background: rgba(68, 136, 255, 0.2);
    color: #6bb3ff;
}

.auth-header-bar .user-info .badge-user {
    background: rgba(68, 136, 255, 0.2);
    color: #6bb3ff;
}

.auth-header-bar .user-info .badge-viewer {
    background: rgba(156, 39, 176, 0.2);
    color: #ce93d8;
}

.auth-header-bar .auth-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.auth-header-bar .auth-actions a {
    color: var(--text-secondary, #aaa);
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: color 0.2s;
}

.auth-header-bar .auth-actions a:hover {
    color: var(--text-primary, #fff);
}

.auth-header-bar .auth-actions .btn-logout {
    padding: 0.35rem 0.75rem;
    background: rgba(255, 68, 68, 0.15);
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 6px;
    color: #ff6b6b;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.auth-header-bar .auth-actions .btn-logout:hover {
    background: rgba(255, 68, 68, 0.25);
    color: #ff8a8a;
}

/* Admin menu for root users */
.admin-menu {
    display: flex;
    gap: 0.75rem;
    padding-right: 0.75rem;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    margin-right: 0.5rem;
}

.admin-menu a {
    color: #ffc107;
}

.admin-menu a:hover {
    color: #ffd54f;
}

/* Responsive */
@media (max-width: 480px) {
    .auth-card {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .auth-header h1 {
        font-size: 1.5rem;
    }
    
    .auth-header .icon {
        font-size: 2.5rem;
    }
    
    .error-card {
        padding: 2rem 1.5rem;
    }
    
    .error-card .error-icon {
        font-size: 4rem;
    }
    
    .error-card h1 {
        font-size: 1.5rem;
    }
    
    .error-actions {
        flex-direction: column;
    }
    
    .error-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .auth-header-bar {
        flex-wrap: wrap;
        padding: 0.75rem;
    }
    
    .auth-header-bar .user-info {
        width: 100%;
        justify-content: center;
        margin-bottom: 0.5rem;
    }
    
    .auth-header-bar .auth-actions {
        width: 100%;
        justify-content: center;
        margin-left: 0;
    }
    
    .admin-menu {
        border-right: none;
        padding-right: 0;
        margin-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding-bottom: 0.5rem;
        margin-bottom: 0.5rem;
    }
}

/* Password strength indicator */
.password-strength {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    width: 0;
    transition: width 0.3s, background-color 0.3s;
    border-radius: 2px;
}

.password-strength-bar.weak {
    width: 25%;
    background: #ff4444;
}

.password-strength-bar.fair {
    width: 50%;
    background: #ff9800;
}

.password-strength-bar.good {
    width: 75%;
    background: #ffc107;
}

.password-strength-bar.strong {
    width: 100%;
    background: #4caf50;
}

.password-hint {
    font-size: 0.8rem;
    color: var(--text-secondary, #888);
    margin-top: 0.5rem;
}

/* Session list for account page */
.session-list {
    margin-top: 1rem;
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.session-item.current {
    border-color: rgba(76, 175, 80, 0.3);
    background: rgba(76, 175, 80, 0.1);
}

.session-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.session-info .device {
    color: var(--text-primary, #fff);
    font-size: 0.9rem;
}

.session-info .meta {
    color: var(--text-secondary, #888);
    font-size: 0.8rem;
}

.session-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
    margin-left: 0.5rem;
}
