/* assets/css/style.css - Mismo CSS que antes pero con ajustes para PHP */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* ===== LOGIN ===== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-box {
    background: white;
    border-radius: 15px;
    padding: 40px 35px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-icon {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 10px;
}

.login-header h1 {
    color: #2d3748;
    font-size: 24px;
}

.login-header p {
    color: #718096;
    font-size: 14px;
    margin-top: 5px;
}

.login-error {
    display: none;
    background: #fc8181;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 14px;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn-login:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.password-input {
    position: relative;
}

.password-input input {
    width: 100%;
    padding-right: 45px;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    font-size: 18px;
}

.toggle-password:hover {
    color: #667eea;
}

.login-footer {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.demo-creds {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    font-size: 12px;
    color: #4a5568;
}

.demo-creds span {
    background: #f7fafc;
    padding: 4px 8px;
    border-radius: 4px;
}

/* ===== DASHBOARD ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    padding: 25px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    color: #333;
    font-size: 24px;
}

header h1 i {
    color: #667eea;
    margin-right: 10px;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-primary, .btn-audit, .btn-logout {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: white;
}

.btn-primary {
    background: #667eea;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.btn-audit {
    background: #9f7aea;
}

.btn-audit:hover {
    background: #805ad5;
    transform: translateY(-2px);
}

.btn-logout {
    background: #fc8181;
}

.btn-logout:hover {
    background: #f56565;
    transform: translateY(-2px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: #edf2f7;
    border-radius: 20px;
    font-size: 14px;
}

.user-info i {
    font-size: 20px;
    color: #667eea;
}

.rol-badge {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.rol-badge.admin { background: #e53e3e; }
.rol-badge.ti { background: #4299e1; }
.rol-badge.consulta { background: #48bb78; }

/* Filtro */
.filtro-sede {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filtro-sede label {
    font-weight: 600;
    color: #4a5568;
}

.filtro-sede select {
    padding: 8px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    min-width: 200px;
}

.contador {
    margin-left: auto;
    font-size: 14px;
    color: #718096;
}

/* Tabla */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    background: #667eea;
    color: white;
}

th {
    padding: 12px 8px;
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    padding: 10px 8px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

tr:hover {
    background: #f7fafc;
}

.badge-sede {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.link-email, .link-phone {
    color: #4299e1;
    text-decoration: none;
}

.link-email:hover, .link-phone:hover {
    text-decoration: underline;
}

.text-truncate {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.acciones {
    display: flex;
    gap: 5px;
}

.btn-edit, .btn-delete, .btn-view {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    color: white;
}

.btn-edit {
    background: #4299e1;
}

.btn-edit:hover {
    background: #3182ce;
    transform: scale(1.05);
}

.btn-delete {
    background: #fc8181;
}

.btn-delete:hover {
    background: #f56565;
    transform: scale(1.05);
}

.btn-view {
    background: #48bb78;
}

.btn-view:hover {
    background: #38a169;
    transform: scale(1.05);
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background: white;
    margin: 2% auto;
    padding: 25px;
    border-radius: 12px;
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideDown 0.3s;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.modal-header h2 {
    color: #2d3748;
}

.modal-header h2 i {
    color: #667eea;
    margin-right: 10px;
}

.close {
    font-size: 30px;
    cursor: pointer;
    color: #a0aec0;
    transition: color 0.3s;
}

.close:hover {
    color: #e53e3e;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #4a5568;
}

.form-group label i {
    margin-right: 8px;
    color: #667eea;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
    border-top: 2px solid #e2e8f0;
    padding-top: 20px;
}

.btn-save {
    padding: 10px 25px;
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-save:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

.btn-cancel {
    padding: 10px 25px;
    background: #fc8181;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-cancel:hover {
    background: #f56565;
    transform: translateY(-2px);
}

/* ===== MODAL VIEW ===== */
.modal-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}

.modal-view-content {
    background: white;
    border-radius: 12px;
    width: 95%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 25px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideDown 0.3s;
}

.modal-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.modal-view-header h2 {
    color: #2d3748;
    font-size: 22px;
}

.modal-view-header h2 i {
    color: #667eea;
    margin-right: 10px;
}

.close-view {
    font-size: 30px;
    cursor: pointer;
    color: #a0aec0;
    transition: color 0.3s;
}

.close-view:hover {
    color: #e53e3e;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.detail-item {
    background: #f7fafc;
    padding: 12px;
    border-radius: 8px;
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.detail-item label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #718096;
    margin-bottom: 4px;
}

.detail-item label i {
    margin-right: 5px;
    color: #667eea;
}

.detail-item p {
    font-size: 14px;
    color: #2d3748;
    word-break: break-word;
}

.modal-view-footer {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
    border-top: 2px solid #e2e8f0;
    padding-top: 20px;
}

.btn-close {
    padding: 10px 25px;
    background: #a0aec0;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-close:hover {
    background: #718096;
}

/* ===== AUDITORÍA ===== */
.modal-audit {
    max-width: 900px !important;
}

.audit-item {
    background: #f7fafc;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.audit-header {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 5px;
}

.audit-action {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.audit-action.CREACION_MAQUINA { background: #48bb78; }
.audit-action.ACTUALIZACION_MAQUINA { background: #4299e1; }
.audit-action.ELIMINACION_MAQUINA { background: #fc8181; }
.audit-action.CONSULTA_MAQUINA { background: #9f7aea; }

.audit-user, .audit-date {
    font-size: 13px;
    color: #4a5568;
}

.audit-details {
    font-size: 13px;
    color: #718096;
    padding-left: 10px;
    border-left: 2px solid #e2e8f0;
    margin-top: 5px;
}

.audit-details pre {
    background: #edf2f7;
    padding: 8px;
    border-radius: 4px;
    font-size: 12px;
    overflow-x: auto;
    margin-top: 5px;
}

.empty-audit {
    text-align: center;
    padding: 40px;
    color: #a0aec0;
}

/* ===== MENSAJES ===== */
.mensaje-flotante {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 2000;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.mensaje-flotante.success { background: #48bb78; }
.mensaje-flotante.error { background: #fc8181; }

.mensaje-flotante i {
    margin-right: 10px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-content, .modal-view-content {
        margin: 5% auto;
        width: 98%;
        padding: 15px;
    }
    
    header h1 {
        font-size: 18px;
    }
    
    .filtro-sede {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filtro-sede select {
        min-width: 100%;
    }
    
    .contador {
        margin-left: 0;
    }
    
    table {
        font-size: 11px;
    }
    
    th, td {
        padding: 6px 4px;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .user-info {
        width: 100%;
        justify-content: center;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a67d8;
}