/**
 * REDENES Portal V2 - Main Stylesheet
 * Modern, clean design with Bootstrap 5 enhancements
 */

/* ========================================
   CSS Custom Properties (Theme)
   ======================================== */
:root {
    --redenes-primary: #2563eb;
    --redenes-primary-hover: #1d4ed8;
    --redenes-primary-light: rgba(37, 99, 235, 0.15);
    --redenes-red: #e63946;
    --redenes-dark: #0d1b2a;
    --redenes-dark-light: #1b2838;
    --redenes-gray: #6c757d;
    --redenes-light: #f8f9fc;
    --redenes-white: #ffffff;
    --redenes-border: #e3e6f0;
    --redenes-shadow: 0 0.15rem 1.75rem 0 rgba(13, 27, 42, 0.15);
    --redenes-shadow-lg: 0 1rem 3rem rgba(13, 27, 42, 0.25);
    --redenes-radius: 0.5rem;
    --redenes-radius-lg: 1rem;
    --redenes-transition: all 0.2s ease-in-out;
    --gradient-primary: linear-gradient(135deg, #0d1b2a 0%, #1b3a5c 50%, #0d1b2a 100%);
    --gradient-card: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
}

/* ========================================
   Global Styles
   ======================================== */
body {
    font-family: 'Inter', 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--redenes-light);
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Auth Pages (Login, Register, Forgot Password)
   ======================================== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 70%, rgba(37, 99, 235, 0.12) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.03) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, -2%) rotate(1deg); }
    66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 960px;
    border-radius: var(--redenes-radius-lg);
    overflow: hidden;
    box-shadow: var(--redenes-shadow-lg);
    background: var(--redenes-white);
}

.auth-brand {
    background: var(--redenes-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    color: var(--redenes-white);
    position: relative;
}

.auth-brand::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.15) 0%, transparent 70%);
}

.auth-brand img {
    max-width: 120px;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.auth-brand h2 {
    position: relative;
    z-index: 1;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 0.05em;
    margin: 0;
}

.auth-brand p {
    position: relative;
    z-index: 1;
    opacity: 0.7;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.auth-form-area {
    padding: 3rem;
}

@media (max-width: 767.98px) {
    .auth-form-area {
        padding: 2rem 1.5rem;
    }
    .auth-brand {
        padding: 2rem 1.5rem;
    }
    .auth-brand img {
        max-width: 80px;
        margin-bottom: 1rem;
    }
}

.auth-form-area h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--redenes-dark);
    margin-bottom: 0.25rem;
}

.auth-form-area p.subtitle {
    color: var(--redenes-gray);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* ========================================
   Form Controls (Modern)
   ======================================== */
.form-floating > .form-control {
    border: 2px solid var(--redenes-border);
    border-radius: var(--redenes-radius);
    padding: 1rem 0.75rem;
    height: calc(3.5rem + 4px);
    transition: var(--redenes-transition);
    font-size: 0.95rem;
}

.form-floating > .form-control:focus {
    border-color: var(--redenes-primary);
    box-shadow: 0 0 0 0.2rem var(--redenes-primary-light);
}

.form-floating > label {
    padding: 1rem 0.75rem;
    color: var(--redenes-gray);
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: var(--redenes-primary);
}

/* Phone code input styling */
.phone-code-input {
    cursor: pointer !important;
    background-color: var(--redenes-light) !important;
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.phone-code-input:hover {
    border-color: var(--redenes-primary) !important;
}

/* ========================================
   Buttons
   ======================================== */
.btn-redenes {
    background: var(--redenes-primary);
    border: none;
    color: var(--redenes-white);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--redenes-radius);
    font-size: 1rem;
    letter-spacing: 0.025em;
    transition: var(--redenes-transition);
    position: relative;
    overflow: hidden;
}

.btn-redenes:hover:not(:disabled) {
    background: var(--redenes-primary-hover);
    color: var(--redenes-white);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-redenes:active:not(:disabled) {
    transform: translateY(0);
}

.btn-redenes:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-redenes .spinner-border {
    width: 1.25rem;
    height: 1.25rem;
    border-width: 0.15em;
}

/* ========================================
   Alert Messages
   ======================================== */
.alert-message {
    border-radius: var(--redenes-radius);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease;
}

.alert-message.show {
    display: flex;
}

.alert-message.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-message.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Terms & Conditions Checkbox
   ======================================== */
.form-check-input:checked {
    background-color: var(--redenes-primary);
    border-color: var(--redenes-primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem var(--redenes-primary-light);
    border-color: var(--redenes-primary);
}

.form-check-label {
    font-size: 0.85rem;
    color: var(--redenes-gray);
}

.form-check-label a {
    color: var(--redenes-primary);
    text-decoration: none;
    font-weight: 600;
}

.form-check-label a:hover {
    text-decoration: underline;
}

/* ========================================
   Auth Footer Links
   ======================================== */
.auth-links {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--redenes-border);
}

.auth-links a {
    color: var(--redenes-gray);
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--redenes-transition);
}

.auth-links a:hover {
    color: var(--redenes-primary);
}

.auth-links .separator {
    display: inline-block;
    width: 4px;
    height: 4px;
    background: var(--redenes-border);
    border-radius: 50%;
    vertical-align: middle;
    margin: 0 0.75rem;
}

/* ========================================
   Password Strength Indicator
   ======================================== */
.password-strength {
    height: 3px;
    border-radius: 2px;
    margin-top: 0.25rem;
    transition: var(--redenes-transition);
    background: var(--redenes-border);
}

.password-strength .bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease, background 0.3s ease;
    width: 0;
}

.password-strength .bar.weak { width: 25%; background: #dc3545; }
.password-strength .bar.medium { width: 50%; background: #ffc107; }
.password-strength .bar.good { width: 75%; background: #17a2b8; }
.password-strength .bar.strong { width: 100%; background: #28a745; }

/* ========================================
   Password Requirements Checklist
   ======================================== */
.password-requirements {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.2rem 1rem;
}

.password-requirements li {
    font-size: 0.78rem;
    color: var(--redenes-gray);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: color 0.2s ease;
}

.password-requirements li .req-icon {
    font-size: 0.7rem;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}

.password-requirements li.met {
    color: #28a745;
}

.password-requirements li.met .req-icon::before {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
}

.password-requirements li:not(.met) .req-icon::before {
    content: '\f111';
    font-family: 'Font Awesome 5 Free';
    font-weight: 400;
}

/* ========================================
   OTP Input Group
   ======================================== */
.otp-inputs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.otp-inputs input {
    width: 3rem;
    height: 3.5rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid var(--redenes-border);
    border-radius: var(--redenes-radius);
    transition: var(--redenes-transition);
    color: var(--redenes-dark);
}

.otp-inputs input:focus {
    border-color: var(--redenes-primary);
    box-shadow: 0 0 0 0.2rem var(--redenes-primary-light);
    outline: none;
}

@media (max-width: 400px) {
    .otp-inputs input {
        width: 2.5rem;
        height: 3rem;
        font-size: 1.25rem;
    }
    .otp-inputs {
        gap: 0.35rem;
    }
}

/* ========================================
   Country Code Modal (Modern)
   ======================================== */
.country-modal .modal-content {
    border-radius: var(--redenes-radius-lg);
    border: none;
    overflow: hidden;
}

.country-modal .modal-header {
    background: var(--redenes-dark);
    color: var(--redenes-white);
    border: none;
    padding: 1.25rem 1.5rem;
}

.country-modal .modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.country-search {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--redenes-border);
}

.country-search input {
    border: 2px solid var(--redenes-border);
    border-radius: var(--redenes-radius);
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
}

.country-search input:focus {
    border-color: var(--redenes-primary);
    box-shadow: 0 0 0 0.2rem var(--redenes-primary-light);
}

.country-list {
    max-height: 350px;
    overflow-y: auto;
    padding: 0.5rem;
}

.country-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    border-radius: var(--redenes-radius);
    cursor: pointer;
    transition: var(--redenes-transition);
    font-size: 0.9rem;
}

.country-item:hover {
    background: var(--redenes-light);
}

.country-item .code {
    font-weight: 600;
    color: var(--redenes-primary);
    min-width: 50px;
}

/* ========================================
   FCM Warning Banner
   ======================================== */
.fcm-warning-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #b45309, #d97706);
    color: #fff;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: bannerSlideDown 0.3s ease;
}

@keyframes bannerSlideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

.fcm-warning-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    max-width: 960px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.fcm-warning-content i {
    font-size: 1rem;
    flex-shrink: 0;
}

.fcm-retry-btn {
    background: #fff;
    color: #b45309;
    border: none;
    border-radius: 4px;
    padding: 0.3rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--redenes-transition);
    white-space: nowrap;
}

.fcm-retry-btn:hover:not(:disabled) {
    background: #fef3c7;
}

.fcm-retry-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.fcm-dismiss-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
    transition: color 0.2s;
}

.fcm-dismiss-btn:hover {
    color: #fff;
}

/* ========================================
   Loading States
   ======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 27, 42, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

/* ========================================
   Utility Classes
   ======================================== */
.text-redenes {
    color: var(--redenes-primary) !important;
}

.bg-redenes {
    background-color: var(--redenes-primary) !important;
}

.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--redenes-gray);
    font-size: 0.8rem;
    margin: 1.5rem 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--redenes-border);
}
