/* 🌑🌕 Modo Claro & Oscuro con Variables CSS */
:root {
    --background-color: #f8f9fa;
    --text-color: #333;
    --container-bg: white;
    --button-bg: #28a745;
    --button-hover: #218838;
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
    --card-border: 1px solid rgba(255, 255, 255, 0.18);
    --select-bg: #ffffff;
    --select-focus-border: #28a745;
    --input-height: 54px;
}

/* 🌑 Modo Oscuro */
.dark-mode {
    --background-color: #121212;
    --text-color: #f8f9fa;
    --container-bg: #1e1e1e;
    --button-bg: #17a2b8;
    --button-hover: #138496;
    --border-color: #444;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --card-bg: rgba(45, 45, 45, 0.7);
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --card-border: 1px solid rgba(255, 255, 255, 0.08);
    --select-bg: #2d2d2d;
    --select-focus-border: #17a2b8;
}

/* 🌕 Aplicación de los estilos según el modo */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-container {
    width: 90%;
    max-width: 1200px;
    margin: 40px auto;
    background: var(--container-bg);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px var(--shadow-color);
    transition: background 0.3s;
}

.watermark {
    position: absolute;
    top: 20px;
    left: 30px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
    opacity: 0.8;
}

.watermark span {
    color: #28a745;
}

/* Nuevo estilo para usuario y botón de logout */
#user-menu-container {
    position: absolute;
    top: 20px;
    right: 120px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 100;
}

#user-greeting {
    font-weight: 500;
    color: var(--text-color);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.8;
    transition: all 0.3s;
    padding: 5px 10px;
    border-radius: 8px;
    background: rgba(220, 53, 69, 0.1);
}

.logout-btn:hover {
    opacity: 1;
    background: rgba(220, 53, 69, 0.2);
    transform: translateY(-2px);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    #user-menu-container {
        position: static;
        justify-content: flex-end;
        padding: 10px 20px;
    }
}

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Estilos modernos para selects 2025 */
.form-select,
.form-input {
    width: 100%;
    height: var(--input-height);
    padding: 0 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--select-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Estilo para el select personalizado con icono */
.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: '▼';
    font-size: 0.8rem;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-color);
    opacity: 0.5;
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: var(--select-focus-border);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
    transform: translateY(-2px);
}

/* Nueva tarjeta con efecto glassmorphism para detalles de la compañía */
.company-details-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: var(--card-shadow);
    border: var(--card-border);
    transition: all 0.3s ease;
}

.company-details-card:hover {
    box-shadow: 0 10px 40px rgba(31, 38, 135, 0.2);
    transform: translateY(-5px);
}

.company-details-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    font-weight: 500;
    color: var(--text-color);
    opacity: 0.8;
    text-align: center;
}

.company-details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 992px) {
    .company-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .company-details-grid {
        grid-template-columns: 1fr;
    }
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.detail-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.detail-item i {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    border-radius: 50%;
    padding: 10px;
}

.detail-item span {
    font-weight: 500;
    word-break: break-word;
}

.btn {
    background: var(--button-bg);
    color: white;
    border: none;
    padding: 16px 30px;
    cursor: pointer;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.btn:hover {
    background: var(--button-hover);
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(40, 167, 69, 0.4);
}

.btn:active {
    transform: translateY(-1px);
}

.file-upload-container {
    margin: 30px 0;
    text-align: center;
}

.file-upload-label {
    display: block;
    padding: 30px;
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.file-upload-label:hover {
    border-color: var(--select-focus-border);
    background: rgba(40, 167, 69, 0.05);
    transform: translateY(-3px);
}

.file-upload-label i {
    font-size: 2.5rem;
    color: #28a745;
    margin-bottom: 15px;
}

.file-upload-label p {
    margin: 10px 0 0;
    font-weight: 500;
}

.file-selected {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.file-upload-input {
    display: none;
}

.submit-container {
    text-align: center;
    margin-top: 40px;
}

#message {
    margin-top: 30px;
    transition: all 0.3s ease;
}

#message ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

#message li {
    margin: 10px 0;
}

#message a {
    color: #28a745;
    text-decoration: none;
    padding: 12px 20px;
    border: 1px solid #28a745;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
    background: rgba(40, 167, 69, 0.05);
}

#message a:hover {
    background: #28a745;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.success-message {
    padding: 20px;
    border-radius: 12px;
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.success-message i {
    font-size: 2rem;
    color: #28a745;
    margin-bottom: 15px;
}

.error-message {
    padding: 20px;
    border-radius: 12px;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.error-message i {
    font-size: 2rem;
    color: #dc3545;
    margin-bottom: 15px;
}

.info-message {
    padding: 20px;
    border-radius: 12px;
    background: rgba(23, 162, 184, 0.1);
    border: 1px solid rgba(23, 162, 184, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.info-message i {
    font-size: 2rem;
    color: #17a2b8;
    margin-bottom: 15px;
}

.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 30px 0;
}

.loading-indicator i {
    font-size: 2.5rem;
    color: #28a745;
    margin-bottom: 15px;
}

/* Estilos para las mensajes del sistema Django */
.messages-container {
    margin-bottom: 20px;
}

/* 🌙 Switch Night Mode - Estilo 2025 */
#night-mode-container {
    position: absolute;
    top: 20px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
}

#night-mode-label {
    font-size: 1rem;
    color: var(--text-color);
}

/* Switch personalizado */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(204, 204, 204, 0.5);
    transition: 0.4s;
    border-radius: 30px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
    background-color: rgba(40, 167, 69, 0.8);
}

input:checked + .slider:before {
    transform: translateX(30px);
}

/* Animate highlight */
@keyframes highlight-pulse {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

.highlight {
    animation: highlight-pulse 1.5s ease-out;
}

/* Estilos adicionales para la página de login */
.auth-container {
    max-width: 450px;
    margin: 100px auto;
    background: var(--container-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    text-align: center;
}

.auth-logo {
    font-size: 2rem;
    margin-bottom: 30px;
    color: var(--text-color);
    opacity: 0.8;
}

.auth-logo span {
    color: #28a745;
}

.auth-form {
    margin-top: 30px;
}

.login-btn {
    width: 100%;
    margin-top: 20px;
}

.messages {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
}

.messages li {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
}

.messages .success {
    background-color: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.2);
    color: #28a745;
}

.messages .error {
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.messages .info {
    background-color: rgba(23, 162, 184, 0.1);
    border: 1px solid rgba(23, 162, 184, 0.2);
    color: #17a2b8;
}

/* Estilos para facturas enviadas y pendientes */
.invoice-sent {
    background-color: rgba(40, 167, 69, 0.08);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge i {
    margin-right: 5px;
}

.status-badge.sent {
    background-color: rgba(40, 167, 69, 0.15);
    color: #28a745;
}

.status-badge.pending {
    background-color: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.btn-icon.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: rgba(0, 0, 0, 0.05);
}