/* Custom Styles for Matriz ISO */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Smooth View Transitions */
.view-container {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Matriz Table Styles */
.matriz-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.matriz-table th {
    background-color: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    position: sticky;
    top: 0;
    z-index: 10;
}

.matriz-table th.sticky-col {
    position: sticky;
    left: 0;
    z-index: 20;
    background-color: #f9fafb;
    border-right: 2px solid #e5e7eb;
}

.matriz-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    color: #374151;
}

.matriz-table td.sticky-col {
    position: sticky;
    left: 0;
    background-color: white;
    border-right: 2px solid #e5e7eb;
    z-index: 5;
}

.matriz-table tbody tr:hover td {
    background-color: #f9fafb;
}

.matriz-table tbody tr:hover td.sticky-col {
    background-color: #f3f4f6;
}

/* Nivel Badge Colors */
.nivel-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
}

.nivel-iv {
    background-color: #dbeafe;
    color: #1e40af;
}

.nivel-iii {
    background-color: #dcfce7;
    color: #15803d;
}

.nivel-ii {
    background-color: #fef3c7;
    color: #92400e;
}

.nivel-i {
    background-color: #e0e7ff;
    color: #4338ca;
}

/* Checkbox Custom Styles */
.matriz-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #2563eb;
}

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

/* Responsibility Header */
.resp-header {
    min-width: 80px;
    text-align: center;
}

.resp-header .resp-code {
    font-weight: 600;
    color: #1f2937;
}

.resp-header .resp-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.resp-header .resp-tooltip:hover::after {
    content: attr(data-description);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #1f2937;
    color: white;
    font-size: 12px;
    font-weight: normal;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 1000;
    max-width: 300px;
    white-space: normal;
}

/* Cargo Card Styles */
.cargo-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.cargo-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-color: #d1d5db;
}

.cargo-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.cargo-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.cargo-card-actions {
    display: flex;
    gap: 8px;
}

/* Role Card Styles */
.role-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.role-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-card-autoridades {
    list-style: none;
    padding: 0;
}

.role-card-autoridades li {
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.6;
}

.role-card-autoridades li:last-child {
    border-bottom: none;
}

.role-card-autoridades li::before {
    content: "•";
    color: #3b82f6;
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-in-out;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toast Animation */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

#toast:not(.hidden) {
    animation: slideInRight 0.3s ease-out;
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* Responsive Table Wrapper */
@media (max-width: 768px) {
    .matriz-table th,
    .matriz-table td {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .resp-header {
        min-width: 60px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    header,
    button,
    .no-print {
        display: none !important;
    }
    
    .matriz-table {
        page-break-inside: auto;
    }
    
    .matriz-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Input Focus Styles */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    ring: 2px;
    ring-color: #3b82f6;
}

/* Button Disabled State */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #6b7280;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: #d1d5db;
}
