:root {
    --primary-color: #016e97;
    --secondary-color: #43bdd8;
    --light-color: #f5f5f5;
    --dark-color: #333;
    --sidebar-width: 250px;
    --sidebar-width-collapsed: 70px;
    --header-height: 60px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f0f4f8;
    color: var(--dark-color);
    transition: margin-left 0.3s ease;
}

/* Sidebar */
.sidebar {
    position: fixed;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(to bottom, var(--primary-color), var(--primary-color) 95%);
    color: white;
    padding: 20px 0;
    overflow-y: auto;
    transition: all 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar-header h2 {
    font-size: 24px;
    margin-bottom: 5px;
}

.sidebar-menu {
    margin-top: 30px;
}

.sidebar-menu-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.sidebar-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-menu-item.active {
    background-color: var(--secondary-color);
}

.sidebar-menu-item i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
}

.sidebar-menu-item span {
    transition: opacity 0.3s ease;
}

.sidebar-menu-item span a{
    text-decoration: none;
    color: #ffffff;
}

/* Hamburger menu for mobile */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1001;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px;
    cursor: pointer;
    font-size: 18px;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 20px 15px; /* Reducir padding lateral */
    transition: margin-left 0.3s ease;
}

.content-header {
    margin-bottom: 30px;
}

.content-header h1 {
    font-size: 28px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Project Cards */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.project-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.project-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 20px;
}

.project-header h3 {
    font-size: 18px;
    font-weight: 500;
}

.project-body {
    padding: 20px;
}

.project-body p {
    margin-bottom: 20px;
    color: #666;
    line-height: 1.5;
}


.project-body a {
    display: inline-block; 
    color: #3d3d3d;         
    text-decoration: none; 
    border-radius: 5px;    
    font-weight: bold;    
    text-align: center;    
    transition: background-color 0.3s ease; 
    margin-top: 10px;   
}

.project-button {
    display: inline-block;
    background-color: var(--secondary-color);
    color: white;
    padding: 8px 15px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.project-button:hover {
    background-color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 992px) {
    .project-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .menu-toggle {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .project-grid {
        grid-template-columns: 1fr;
    }
}

/* Login Styles */
.login-container {
    width: 100%;
    max-width: 400px;
    background-color: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.login-header {
    background-color: var(--primary-color);
    color: white;
    padding: 25px 0;
    text-align: center;
    position: relative;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 600;
}

.login-body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-color: #f5f5f5;
}

.form-container {
    padding: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--dark-color);
    font-weight: 500;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-control:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(67, 189, 216, 0.2);
    outline: none;
}

.btn {
    display: inline-block;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.3s, transform 0.2s;
}

.btn:hover {
    background-color: #39aec7;
}

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

.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideDown 0.3s ease-out;
}

.alert-error {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.alert-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.alert-content strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.alert-content p {
    margin: 0;
    line-height: 1.4;
}

.alert-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #721c24;
    opacity: 0.7;
}

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

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

@media (max-width: 480px) {
    .login-container {
        border-radius: 0;
        box-shadow: none;
    }
    
    .form-container {
        padding: 20px;
    }
}
/* ============= CRUD STYLES ============= */

/* Buttons */
.btn {
    display: inline-block;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s, transform 0.2s;
    margin: 2px;
}

.btn:hover {
    background-color: #39aec7;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #014d6e;
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-danger {
    background-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
    margin-right: 3px; /* Reducir margen entre botones */
}

/* Tabla CRUD */
.table-container {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
    overflow-x: auto; /* Permitir scroll horizontal si es necesario */
}

.crud-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
}

.crud-table thead {
    background-color: var(--primary-color);
    color: white;
}

.crud-table th,
.crud-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.crud-table th {
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.crud-table tbody tr:hover {
    background-color: #f8f9fa;
}

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

/* Status badges */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-0 {
    background-color: #f8d7da;
    color: #721c24;
}

.status-1 {
    background-color: #d4edda;
    color: #155724;
}

.status-2 {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Actions column */
.actions {
    white-space: nowrap;
    width: 120px; /* Ancho fijo para asegurar espacio */
    min-width: 120px;
}

.actions .btn {
    display: block;
    margin-bottom: 5px;
    width: 100%;
}

/* Modales */
.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 ease;
}

.modal-content {
    position: relative;
    background-color: white;
    margin: 5% auto;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

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

.modal-header {
    background-color: var(--primary-color);
    color: white;
    padding: 20px 25px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 25px;
}

.modal-form {
    padding: 25px;
}

.modal-footer {
    padding: 0 25px 25px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Form elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--dark-color);
    font-weight: 500;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(67, 189, 216, 0.2);
    outline: none;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideDown 0.3s ease-out;
    transition: opacity 0.3s ease;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

.alert-error {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.alert-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.alert-content {
    flex-grow: 1;
}

.alert-content p {
    margin: 0;
    line-height: 1.4;
}

.alert-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
}

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

/* Content header adjustments */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.content-header > div {
    flex-grow: 1;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Responsive adjustments for CRUD */
@media (max-width: 768px) {
    .content-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .crud-table {
        font-size: 12px;
    }
    
    .crud-table th,
    .crud-table td {
        padding: 8px 10px;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-header,
    .modal-body,
    .modal-form {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 0 20px 20px;
        flex-direction: column;
    }
    
    .actions .btn {
        padding: 4px 8px;
        font-size: 12px;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Scroll suave en iOS */
    }
    
    .crud-table {
        min-width: 650px; /* Asegurar ancho mínimo */
    }
    
    .actions {
        width: 100px;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .table-container {
        overflow-x: auto;
    }
    
    .crud-table {
        min-width: 600px;
    }
}

.crud-table th.actions,
.crud-table td.actions {
    position: sticky;
    right: 0;
    z-index: 2;
}

.description-cell {
    max-width: 200px;
    cursor: help;
}

.file-code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    color: #333;
}

.user-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
}

.user-badge i {
    margin-right: 4px;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}