/* ============= COMPONENTES UI COMPARTIDOS ============= */

/* ===== NAVBAR ===== */
.navbar-component {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand a {
    color: white;
    text-decoration: none;
    font-size: 1.5em;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-icon {
    font-size: 1.2em;
}

.navbar-links {
    display: flex;
    gap: 20px;
}

.navbar-link {
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.navbar-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    font-size: 0.95em;
}

.navbar-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.navbar-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

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

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #333;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #d0d0d0;
}

.btn-danger {
    background-color: #f44336;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #d32f2f;
}

.btn-success {
    background-color: #4caf50;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #45a049;
}

/* Tamaños */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.9em;
}

.btn-md {
    padding: 10px 20px;
    font-size: 1em;
}

.btn-lg {
    padding: 12px 30px;
    font-size: 1.1em;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ===== MODALES ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2100;
}

.modal.hidden {
    display: none !important;
}

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 0;
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
}

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

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

.modal-lg .modal-content {
    width: 90%;
    max-width: 800px;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-btn:hover {
    background-color: #f5f5f5;
    border-color: #999;
}

.modal-btn:first-child {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

.modal-btn:first-child:hover {
    background-color: #5568d3;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-body {
    padding: 20px;
}

.card-title {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    color: #333;
}

.card-content {
    margin: 0;
    color: #666;
    line-height: 1.6;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    background-color: #f9f9f9;
}

/* ===== FORMULARIOS ===== */
.form-component {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: #333;
}

.required {
    color: #f44336;
}

.form-input,
.form-component textarea,
.form-component select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-input:focus,
.form-component textarea:focus,
.form-component select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input.error,
.form-component textarea.error {
    border-color: #f44336;
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1);
}

.form-component textarea {
    resize: vertical;
    min-height: 100px;
}

/* ===== TABLAS (Modern & Dense) ===== */
.table-component {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: white;
}

.table-component table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}

.table-component thead {
    background-color: var(--color-background-hover);
    border-bottom: 1px solid var(--color-border);
}

.table-component th {
    padding: 12px 20px;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.table-component td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border-light);
    color: var(--color-text-primary);
    font-size: 0.9375rem;
    vertical-align: middle;
}

.table-component tbody tr {
    transition: background-color 0.1s ease;
}

.table-component tbody tr:last-child td {
    border-bottom: none;
}

.table-component tbody tr:hover {
    background-color: var(--color-background-hover);
}

.table-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-icon {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 1.1em;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
}

.btn-icon:hover {
    background-color: var(--color-background-hover);
    color: var(--color-primary);
    border-color: var(--color-border-light);
}

.btn-edit {
    color: var(--color-text-secondary);
}

.btn-edit:hover {
    color: var(--color-primary);
    background: rgba(94, 106, 210, 0.1);
}

.btn-delete {
    color: var(--color-text-secondary);
}

.btn-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* ===== SPINNERS ===== */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
}

.spinner-md {
    width: 40px;
    height: 40px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ===== ALERTAS ===== */
.alert {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-info {
    background-color: #e3f2fd;
    color: #1976d2;
    border-left: 4px solid #1976d2;
}

.alert-success {
    background-color: #e8f5e9;
    color: #388e3c;
    border-left: 4px solid #388e3c;
}

.alert-warning {
    background-color: #fff3e0;
    color: #f57c00;
    border-left: 4px solid #f57c00;
}

.alert-error {
    background-color: #ffebee;
    color: #c62828;
    border-left: 4px solid #c62828;
}

.alert-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5em;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.alert-close:hover {
    opacity: 1;
}

/* ===== NOTIFICACIONES ===== */
.notification {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* ===== ANIMACIONES COMUNES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .navbar-component {
        flex-direction: column;
        gap: 15px;
        padding: 10px;
    }

    .navbar-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .navbar-user {
        width: 100%;
        justify-content: center;
    }

    .modal-sm .modal-content,
    .modal-md .modal-content,
    .modal-lg .modal-content {
        width: 95%;
    }

    .table-component {
        font-size: 0.9em;
    }

    .table-component th,
    .table-component td {
        padding: 10px;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .modal-btn {
        width: 100%;
    }
}

/* ===== UTILIDADES ===== */
.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.gap-1 {
    gap: 4px;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.gap-5 {
    gap: 20px;
}

.mt-1 {
    margin-top: 4px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 12px;
}

.mt-4 {
    margin-top: 16px;
}

.mt-5 {
    margin-top: 20px;
}

.mb-1 {
    margin-bottom: 4px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 12px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-5 {
    margin-bottom: 20px;
}

.p-1 {
    padding: 4px;
}

.p-2 {
    padding: 8px;
}

.p-3 {
    padding: 12px;
}

.p-4 {
    padding: 16px;
}

.p-5 {
    padding: 20px;
}

/* ============================================
   ALERTAS / MENSAJES - ESTILOS ADICIONALES
   ============================================ */

.alert {
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: #efe;
    border: 2px solid #9f9;
    color: #3c3;
}

.alert-error {
    background: #fee;
    border: 2px solid #f99;
    color: #c33;
}

.alert-warning {
    background: #ffe;
    border: 2px solid #ff9;
    color: #cc3;
}

.alert-info {
    background: #eef;
    border: 2px solid #99f;
    color: #33c;
}

/* ============================================
   BOTONES PREMIUM (Vibrant & Gradient)
   ============================================ */

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #4c55b0 100%);
    color: white;
    border: none;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(94, 106, 210, 0.25);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(94, 106, 210, 0.35);
    background: linear-gradient(135deg, #6e79df 0%, #5e6ad2 100%);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(94, 106, 210, 0.2);
}

.btn-secondary {
    background: white;
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-background-hover);
    border-color: var(--color-primary-300);
    color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    font-weight: 600;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.35);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    font-weight: 600;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}

/* ============================================
   BADGES & PILLS
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    /* Pill shape */
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ============================================
   ANIMATED ICONS (Micro-interactions)
   ============================================ */
.icon-animated {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-primary:hover .icon-animated {
    transform: scale(1.2) rotate(5deg);
}

.icon-spin-slow {
    animation: spin 3s linear infinite;
}

.icon-pulse {
    animation: iconPulse 2s infinite;
}

@keyframes iconPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(0.9);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   SPINNER / LOADING (Modern)
   ============================================ */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: currentColor;
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   SKELETON LOADING
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}