/* RESPONSIVE.CSS - Sistema de Grúas y Servicios */
/* Archivo CSS responsivo para todos los componentes del sistema */

/* ===== RESET Y BASE ===== */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* ===== CONTENEDORES PRINCIPALES ===== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.main-content {
    padding: 20px;
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

/* ===== SIDEBAR RESPONSIVO ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: -250px;
    width: 250px;
    height: 100vh;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    transition: left 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar.active {
    left: 0;
}

.sidebar-toggle {
    display: block;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: #1e3c72;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* ===== NAVEGACIÓN ===== */
.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-link {
    display: block;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ===== TABLAS RESPONSIVAS ===== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

th, td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
}

th {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    color: white;
}

/* ===== FORMULARIOS RESPONSIVOS ===== */
.form-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.form-col {
    flex: 1;
    min-width: 250px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #1e3c72;
    box-shadow: 0 0 0 3px rgba(30, 60, 114, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ===== BOTONES RESPONSIVOS ===== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    margin: 5px;
}

.btn-primary {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
    min-width: 80px;
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
    min-width: 160px;
}

.btn-block {
    width: 100%;
    display: block;
}

/* ===== MODALES RESPONSIVOS ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
    position: relative;
}

.modal-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    position: relative;
}

.modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    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.3s ease;
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== CARDS Y PANELES ===== */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 20px;
    font-weight: 600;
    font-size: 18px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

/* ===== ALERTAS Y MENSAJES ===== */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    border-left: 4px solid;
    font-weight: 500;
}

.alert-success {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* ===== BADGES Y ESTADOS ===== */
.badge {
    display: inline-block;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: #28a745;
    color: white;
}

.badge-danger {
    background: #dc3545;
    color: white;
}

.badge-warning {
    background: #ffc107;
    color: #212529;
}

.badge-info {
    background: #17a2b8;
    color: white;
}

.badge-secondary {
    background: #6c757d;
    color: white;
}

/* ===== UTILIDADES ===== */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-10 {
    gap: 10px;
}

.gap-15 {
    gap: 15px;
}

.gap-20 {
    gap: 20px;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.p-10 {
    padding: 10px;
}

.p-20 {
    padding: 20px;
}

/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Tablets (768px y arriba) */
@media (min-width: 768px) {
    .sidebar-toggle {
        display: none;
    }
    
    .sidebar {
        position: relative;
        left: 0;
        width: 250px;
        height: auto;
        min-height: 100vh;
    }
    
    .main-content {
        margin-left: 250px;
        padding: 30px;
    }
    
    .form-row {
        flex-wrap: nowrap;
    }
    
    .form-col {
        min-width: auto;
    }
    
    .modal-content {
        max-width: 700px;
    }
    
    .btn {
        margin: 5px 10px 5px 0;
    }
    
    th, td {
        padding: 15px 12px;
        font-size: 15px;
    }
    
    .card-body {
        padding: 30px;
    }
}

/* Desktop (992px y arriba) */
@media (min-width: 992px) {
    .container {
        padding: 0 30px;
    }
    
    .main-content {
        padding: 40px;
    }
    
    .modal-content {
        max-width: 800px;
    }
    
    .form-container {
        padding: 30px;
    }
    
    th, td {
        padding: 18px 15px;
        font-size: 16px;
    }
    
    .btn {
        padding: 14px 28px;
        font-size: 15px;
    }
    
    .btn-large {
        padding: 18px 36px;
        font-size: 17px;
    }
}

/* Large Desktop (1200px y arriba) */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
    
    .main-content {
        padding: 50px;
    }
    
    .modal-content {
        max-width: 900px;
    }
}

/* Mobile específico (hasta 767px) */
@media (max-width: 767px) {
    html {
        font-size: 14px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .form-container {
        padding: 15px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-col {
        min-width: 100%;
    }
    
    .modal-content {
        margin: 10px;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 5px 0;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 13px;
        min-width: 100px;
    }
    
    .btn-block {
        margin: 10px 0;
    }
    
    .card {
        margin-bottom: 15px;
    }
    
    .card-header {
        padding: 15px;
        font-size: 16px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    table {
        min-width: 500px;
        font-size: 12px;
    }
    
    th, td {
        padding: 8px 6px;
        font-size: 12px;
    }
    
    td {
        color: white;
    }
    
    .alert {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .badge {
        padding: 4px 8px;
        font-size: 10px;
    }
}

/* Extra small devices (hasta 480px) */
@media (max-width: 480px) {
    html {
        font-size: 13px;
    }
    
    .main-content {
        padding: 10px;
    }
    
    .form-container {
        padding: 10px;
    }
    
    .modal-content {
        margin: 5px;
    }
    
    .modal-header {
        padding: 12px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 12px;
        min-width: 80px;
    }
    
    .card-header {
        padding: 12px;
        font-size: 15px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    table {
        min-width: 400px;
        font-size: 11px;
    }
    
    th, td {
        padding: 6px 4px;
        font-size: 11px;
    }
    
    td {
        color: white;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        padding: 10px;
        font-size: 13px;
    }
    
    label {
        font-size: 13px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .sidebar,
    .sidebar-toggle,
    .btn,
    .modal {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .table-responsive {
        overflow: visible;
    }
    
    table {
        min-width: auto;
    }
}

/* ===== ACCESIBILIDAD ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible para navegación por teclado */
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #1e3c72;
    outline-offset: 2px;
}