@tailwind base;
@tailwind components;
@tailwind utilities;

.dropdown-menu.show {
    position: fixed !important;
}

.botonDropdown {
    background-color: #0c1b30 !important;
    border-color: #0c1b30 !important;
}

.botonDropdown + .dropdown-menu {
    position: fixed !important;
    z-index: 9999; /* que quede por encima */
}

.modal-overlay-custom {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1040;  /* NEW */
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease-in-out;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay-custom.active {
    opacity: 1;
}

/* Dialog */
.modal-dialog-custom {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05),
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(-10px);
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative; /* NEW */
    z-index: 1041; /* NEW */
}

.modal-overlay-custom.active .modal-dialog-custom {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-sm {
    max-width: 400px;
}

.modal-md {
    max-width: 600px;
}

.modal-lg {
    max-width: 900px;
}

.modal-xl {
    max-width: 1200px;
}

.modal-fullscreen {
    max-width: 95%;
    max-height: 95vh;
}

/* Header */
.modal-header-custom {
    padding: 24px 32px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    min-height: 80px;
}

.modal-header-custom.has-border {
    border-bottom: 1px solid #e2e8f0;
}

.modal-title-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex: 1;
    position: relative;
}

.modal-icon {
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.modal-icon.light-icon {
    background: rgba(255, 255, 255, 0.15);
}

.modal-title-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-title-custom {
    font-weight: 600;
    font-size: 20px;
    line-height: 1.4;
    margin: 0;
    letter-spacing: -0.01em;
}

.modal-subtitle-custom {
    font-weight: 400;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    opacity: 0.7;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.modal-close-btn-custom {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 16px;
    flex-shrink: 0;
}

.modal-close-btn-custom.light-btn {
    background: rgba(255, 255, 255, 0.2);
}

.modal-close-btn-custom:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
}

.modal-close-btn-custom.light-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Body */
.modal-body-custom {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
    max-height: calc(90vh - 200px);
    color: #334155;
    font-size: 15px;
    line-height: 1.6;
}

.modal-body-custom::-webkit-scrollbar {
    width: 6px;
}

.modal-body-custom::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body-custom::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.modal-body-custom::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Footer */
.modal-footer-custom {
    padding: 20px 32px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
    min-height: 72px;
}

.modal-footer-custom:empty {
    display: none;
}

/* Buttons */
.btn-modal-action {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-modal-close {
    background: #ffffff;
    color: #475569;
    border: 1px solid #cbd5e0;
}

.btn-modal-close:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #1e293b;
}

.btn-modal-close:active {
    background: #e2e8f0;
}

/* Responsive */
@media (max-width: 1000px) {
    .modal-overlay-custom {
        padding: 12px;
    }

    .modal-dialog-custom {
        max-height: 95vh;
        border-radius: 12px;
    }

    .modal-sm,
    .modal-md,
    .modal-lg,
    .modal-xl {
        max-width: 100%;
    }

    .modal-header-custom {
        padding: 20px 24px;
        min-height: auto;
    }

    .modal-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .modal-title-custom {
        font-size: 18px;
    }

    .modal-subtitle-custom {
        font-size: 13px;
    }

    .modal-body-custom {
        padding: 24px;
        max-height: calc(95vh - 180px);
        font-size: 14px;
    }

    .modal-footer-custom {
        padding: 16px 24px;
        flex-wrap: wrap;
        min-height: auto;
    }

    .btn-modal-action {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }
}

/* Print styles */
@media print {
    .modal-overlay-custom {
        background: white;
        position: static;
    }

    .modal-dialog-custom {
        box-shadow: none;
        max-height: none;
    }

    .modal-close-btn-custom {
        display: none;
    }
}

/*
 * =======================================================================================================================================
 *  STYLES FOR INPUTS - v4 (Modern & Enhanced Labels)
 * =======================================================================================================================================
 */

:root {
    --input-bg: #f0f2f5;
    --input-text-color: #1a202c;
    --input-border-color: #e2e8f0;
    --input-focus-border-color: #007bff;
    --input-focus-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    --input-placeholder-color: #a0aec0;
    --input-disabled-bg: #e9ecef;
    --label-color: #4a5568;
    --label-focus-color: #007bff;
    --danger-color: #e53e3e;
}

.dark {
    --input-bg: #2d3748;
    --input-text-color: #edf2f7;
    --input-border-color: #4a5568;
    --input-focus-border-color: #4299e1;
    --input-focus-shadow: 0 0 0 3px rgba(66, 153, 225, 0.3);
    --input-placeholder-color: #a0aec0;
    --input-disabled-bg: #3a475a;
    --label-color: #a0aec0;
    --label-focus-color: #4299e1;
    --danger-color: #fc8181;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
textarea,
select {
    background-color: var(--input-bg);
    color: var(--input-text-color);
    border: 1px solid var(--input-border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: 1rem;
    width: 100%;
    transition: all 0.2s ease-in-out;
    -webkit-appearance: none;
    appearance: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--input-focus-border-color);
    box-shadow: var(--input-focus-shadow);
}

input[type="text"]:disabled,
input[type="password"]:disabled,
input[type="email"]:disabled,
input[type="number"]:disabled,
input[type="search"]:disabled,
input[type="tel"]:disabled,
input[type="url"]:disabled,
input[type="date"]:disabled,
textarea:disabled,
select:disabled {
    background-color: var(--input-disabled-bg);
    cursor: not-allowed;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.dark select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23a0aec0' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

input[type="date"]::-webkit-calendar-picker-indicator {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="15" viewBox="0 0 24 24"><path fill="%236b7280" d="M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 18H4V8h16v13z"/></svg>');
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.dark input[type="date"]::-webkit-calendar-picker-indicator {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="15" viewBox="0 0 24 24"><path fill="%23a0aec0" d="M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 18H4V8h16v13z"/></svg>');
}

/* Floating Label */
.input-group > label {
    position: absolute;
    top: 1rem;
    left: 1rem;
    color: var(--label-color);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    font-weight: 500;
}

.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label,
.input-group textarea:focus ~ label,
.input-group textarea:not(:placeholder-shown) ~ label {
    top: -0.75rem;
    left: 0.75rem;
    font-size: 0.75rem;
    color: var(--label-focus-color);
    background-color: var(--input-bg);
    padding: 0 0.25rem;
}

.input-group label.required::after {
    content: ' *';
    color: var(--danger-color);
}

/*
 * =======================================================================================================================================
 *  END OF STYLES FOR INPUTS
 * =======================================================================================================================================
 */