/* Custom styles for OLT ONU and Alta IP application */

body {
    position: relative;
    background-color: #f8fafc;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #334155;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    padding-top: 25px; /* Card positioned higher on desktop for Alta IP */
    padding-bottom: 70px; /* Space for the fixed footer */
    box-sizing: border-box;
}

/* Logo Styling */
.logo-container {
    position: absolute !important;
    top: 20px !important;
    left: 25px !important;
    z-index: 1000 !important;
    margin: 0 !important;
}
.logo-container img {
    height: 125px !important;
    width: auto !important;
    border-radius: 4px;
    display: block;
}

/* Footer layout */
.footer-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 12px 0;
    z-index: 1000;
    text-align: center;
}
.footer-fixed p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

/* Containers */
.container-large {
    width: 100%;
    margin: 0 auto;
    padding: 10px 15px;
    box-sizing: border-box;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 15px;
    margin-top: 100px; /* Only moves the login form down to match other logins */
}

/* Form Cards */
.onu-card, .form-signin {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.form-signin {
    padding: 35px 30px;
}

/* Headings */
.form-signin-heading {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin-top: 0;
    margin-bottom: 15px;
    text-align: center;
}

/* Form groups and labels */
.form-group {
    margin-bottom: 12px !important;
}
.form-group label {
    font-weight: 600;
    color: #475569;
    margin-bottom: 4px;
    display: inline-block;
    font-size: 14px;
}

/* Custom form inputs */
.form-control, select.form-control {
    height: auto !important;
    padding: 10px 14px !important;
    margin-bottom: 10px;
    font-size: 15px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
    width: 100% !important;
}
.form-control:focus, select.form-control:focus {
    border-color: #0284c7 !important;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
}
select.form-control {
    background-color: #ffffff;
}

#nap, #idNodoelegido {
    width: 100% !important;
    height: auto !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    background-color: #ffffff;
}
#nap:focus, #idNodoelegido:focus {
    border-color: #0284c7 !important;
    outline: none;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
}

/* Loading spinner for buttons */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

/* Buttons */
.btn-info, .btn-primary {
    border: none !important;
    border-radius: 8px !important;
    padding: 10px 18px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    width: 100% !important;
    transition: background-color 0.2s !important;
    color: #ffffff !important;
}

.btn-info {
    background-color: #0ea5e9 !important;
}
.btn-info:hover, .btn-info:focus {
    background-color: #0284c7 !important;
}
.btn-info:disabled {
    background-color: #94a3b8 !important;
    opacity: 0.8;
}

.btn-primary {
    background-color: #0ea5e9 !important;
    margin-top: 10px;
}
.btn-primary:hover, .btn-primary:focus {
    background-color: #0284c7 !important;
}

/* Informative Banner */
.info-text {
    background-color: #fef3c7;
    border-left: 4px solid #f59e0b;
    color: #78350f;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 15px;
    margin-bottom: 15px;
    line-height: 1.4;
    text-align: left;
}

/* Alert styles */
.alert {
    border-radius: 8px !important;
    margin: 0 0 15px 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    padding: 12px 16px !important;
    line-height: 1.4 !important;
}
.alert-success {
    background-color: #4dff8b !important;
    border-color: #16492f !important;
    color: #14532d !important;
}
.alert-danger {
    background-color: #ffb6b6 !important;
    border-color: #c50303 !important;
    color: #c50303 !important;
}
.alert button.close {
    font-size: 32px !important;
    line-height: 0.8 !important;
    margin-top: -5px !important;
    margin-right: 5px;
    opacity: 0.5 !important;
    transition: opacity 0.15s ease-in-out;
}
.alert button.close:hover {
    opacity: 0.8 !important;
}

/* Section dividers for Alta IP form sections */
.section-divider {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 4px;
    margin-top: 14px !important;
    margin-bottom: 10px !important;
    text-align: left;
}

/* Radio buttons container for Alta IP */
.radio-container {
    display: flex;
    gap: 25px;
    align-items: center;
    padding: 4px 0;
}
.radio-inline {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding-left: 0 !important;
    cursor: pointer;
    font-weight: 500 !important;
    color: #475569;
    margin: 0 !important;
}
.radio-inline input[type="radio"] {
    position: static !important;
    margin: 0 !important;
    cursor: pointer;
    width: 16px !important;
    height: 16px !important;
}

/* Fieldset reset */
fieldset.form-grid {
    border: none;
    padding: 0;
    margin: 0;
}

/* Desktop 3-column view (fits whole form without scrolling) */
@media (min-width: 768px) {
    .container-large {
        max-width: 980px;
    }

    .onu-card {
        padding: 20px 30px 15px 30px;
    }

    .form-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        column-gap: 20px;
        row-gap: 2px;
    }

    .full-width, .section-divider {
        grid-column: 1 / -1;
    }
}

/* Mobile 1-column view (max 520px) */
@media (max-width: 767px) {
    body {
        justify-content: flex-start !important;
        padding-top: 80px !important;
    }

    .container-large {
        max-width: 520px;
    }

    .login-container {
        margin-top: 20px;
    }

    .onu-card {
        padding: 25px 20px 10px 20px;
    }

    .form-grid {
        display: block;
    }

    .logo-container {
        position: absolute !important;
        top: 12px !important;
        left: 15px !important;
        z-index: 1000 !important;
        margin: 0 !important;
    }
    .logo-container img {
        height: 82px !important;
        width: auto !important;
    }
}

/* Intermediate screen widths (768px to 1325px) for Alta IP: logo stays top-left, card shifts down to prevent overlap */
@media (min-width: 768px) and (max-width: 1325px) {
    body {
        padding-top: 130px !important;
    }
}
