@import url("../branding.php");

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

:root {
    --primary-color: var(--brand-primary-color, #667eea);
    --secondary-color: var(--brand-secondary-color, #764ba2);
    --danger-color: #f56565;
    --success-color: #48bb78;
    --warning-color: #ed8936;
    --light-gray: #f7fafc;
    --border-gray: #e2e8f0;
    --text-dark: #2d3748;
    --text-light: #718096;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-gray);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.nav-brand::before {
    content: "";
    display: var(--brand-logo-display);
    width: var(--brand-logo-size);
    height: var(--brand-logo-size);
    background-image: var(--brand-logo);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-right: 10px;
}

.logo-section::before {
    content: "";
    display: var(--brand-logo-display);
    width: var(--brand-logo-login-size);
    height: var(--brand-logo-login-size);
    background-image: var(--brand-logo);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin: 0 auto 15px auto;
}

/* Login: usar solo la imagen del HTML, no el pseudo-elemento */
.logo-section::before {
    display: none;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

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

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

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    display: flex;
    flex: 1;
}

.sidebar {
    width: 250px;
    background: white;
    border-right: 1px solid var(--border-gray);
    padding: 20px 0;
}

.menu {
    list-style: none;
}

.menu li {
    border-bottom: 1px solid var(--border-gray);
}

.menu a {
    display: block;
    padding: 15px 20px;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.3s;
}

.menu a:hover,
.menu a.active {
    background: var(--light-gray);
    color: var(--primary-color);
    border-left: 4px solid var(--primary-color);
    padding-left: 16px;
}

.content-area {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-card h3 {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.stat-card p {
    color: var(--text-light);
    font-size: 14px;
}

/* Cards */
.card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
}

.card h2 {
    margin-bottom: 20px;
    color: var(--text-dark);
    font-size: 20px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 15px;
}

/* Formularios */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

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

.form-group.full-width {
    grid-column: 1 / -1;
}

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

.form-group input,
.form-group textarea,
.form-group select {
    padding: 10px;
    border: 1px solid var(--border-gray);
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.1);
}

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

/* Botones */
.btn-primary,
.btn-primary {
    padding: 12px 25px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s;
    text-decoration: none;
    display: inline-block;
}
.btn-primary:hover,
.btn-small:hover {
    transform: translateY(-2px);
}

.btn-primary.full-width {
    width: 100%;
    padding: 15px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

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

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

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

/* Tablas */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.data-table thead {
    background: var(--light-gray);
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-gray);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-gray);
}

.data-table tbody tr:hover {
    background: var(--light-gray);
}

/* Mensajes */
.message {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: 500;
}

.error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.success {
    background: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

.warning {
    background: #ffe;
    color: #aa6;
    border: 1px solid #ffc;
}

/* Responsivo */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-gray);
    }

    .menu {
        display: flex;
        flex-wrap: wrap;
    }

    .menu li {
        flex: 1 1 auto;
        border-bottom: none;
        border-right: 1px solid var(--border-gray);
    }

    .menu li:last-child {
        border-right: none;
    }

    .menu a {
        padding: 12px 10px;
        text-align: center;
        font-size: 12px;
    }

    .menu a.active {
        border-left: none;
        border-bottom: 4px solid var(--primary-color);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .navbar {
        flex-direction: column;
        gap: 10px;
    }

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

    .content-area {
        padding: 15px;
    }
}

/* Formularios específicos */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-gray);
    padding-bottom: 15px;
}

.modal-close {
    float: right;
    cursor: pointer;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-light);
}

.modal-close:hover {
    color: var(--text-dark);
}

/* Filtros y búsqueda */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid var(--border-gray);
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-dark);
    display: inline-block;
}

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

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.search-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-form input {
    flex: 1;
    min-width: 250px;
}

/* Barras de progreso */
.progress-bar {
    width: 100%;
    height: 20px;
    background: var(--light-gray);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
    border: 1px solid var(--border-gray);
}

.progress-bar .progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
}

/* Badges de estado específicos */
.badge-nueva, .badge-asignada {
    background: var(--warning-color);
    color: white;
}

.badge-completada, .badge-disponible, .badge-success {
    background: var(--success-color);
    color: white;
}

.badge-cancelada, .badge-inactivo, .badge-danger {
    background: var(--danger-color);
    color: white;
}

.badge-off {
    background: #718096;
    color: white;
}

.badge-ocupado, .badge-warning {
    background: var(--warning-color);
    color: white;
}

.badge-en_proceso {
    background: #3182ce;
    color: white;
}

/* Íconos de acción */
.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--light-gray);
    transform: scale(1.1);
}

/* Data table mejorada */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.data-table thead {
    background: var(--light-gray);
}

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-gray);
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-gray);
}

.data-table tbody tr:hover {
    background: var(--light-gray);
}

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

/* Información y tablas de info */
.info-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.info-table tr {
    border-bottom: 1px solid var(--border-gray);
}

.info-table tr:hover {
    background: var(--light-gray);
}

.info-table tr:last-child {
    border-bottom: none;
}

.info-table td {
    padding: 12px 15px;
    text-align: left;
}

.info-table td:first-child {
    width: 40%;
    font-weight: 600;
    background: var(--light-gray);
}

.info-table code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* Timeline de actividad */
.activity-timeline {
    position: relative;
}

.activity-item {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-gray);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-time {
    min-width: 60px;
    font-weight: 600;
    color: var(--primary-color);
}

.activity-content p {
    margin: 5px 0;
    font-size: 14px;
}

.activity-content small {
    color: var(--text-light);
    font-size: 12px;
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.pagination span {
    color: var(--text-dark);
}

/* Botones de admin */
.btn-danger {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    margin-right: 10px;
    margin-bottom: 10px;
}

.btn-danger:hover {
    background: #e53e3e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
}

/* MEDIA QUERIES MEJORADAS PARA RESPONSIVO */

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) {
    .navbar {
        padding: 12px 20px;
    }

    .nav-brand {
        font-size: 20px;
    }

    .content-area {
        padding: 20px;
    }

    .sidebar {
        width: 200px;
    }

    .menu a {
        padding: 12px 15px;
        font-size: 13px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .card {
        padding: 20px;
    }

    .data-table {
        font-size: 13px;
    }

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

/* iPad y tablets medianas (768px) */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-gray);
        padding: 0;
    }

    .menu {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0;
    }

    .menu li {
        flex: 1;
        border-bottom: 1px solid var(--border-gray);
        border-right: 1px solid var(--border-gray);
    }

    .menu li:last-child {
        border-right: none;
    }

    .menu a {
        padding: 12px 8px;
        text-align: center;
        font-size: 11px;
        border-left: none !important;
    }

    .menu a.active {
        border-left: none;
        border-bottom: 4px solid var(--primary-color);
        background: #f9faff;
    }

    .content-area {
        padding: 15px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card h3 {
        font-size: 24px;
    }

    .stat-card p {
        font-size: 12px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .data-table {
        font-size: 12px;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }

    .card {
        padding: 15px;
        margin-bottom: 15px;
    }

    .card h2 {
        font-size: 18px;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .modal-content {
        max-width: 95%;
        width: 95%;
        padding: 20px;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px;
    }

    .btn-primary,
    .btn-small {
        padding: 10px 15px;
        font-size: 13px;
    }

    .btn-primary.full-width {
        width: 100%;
    }

    .filter-bar {
        gap: 8px;
    }

    .filter-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .search-form {
        gap: 8px;
    }

    .search-form input {
        min-width: 150px;
        font-size: 14px;
    }

    .info-table td {
        padding: 10px;
    }

    .info-table td:first-child {
        width: 35%;
        font-size: 12px;
    }

    .activity-item {
        gap: 15px;
    }

    .activity-time {
        min-width: 50px;
        font-size: 12px;
    }

    .activity-content p {
        font-size: 13px;
    }

    .badge {
        font-size: 11px;
        padding: 4px 8px;
    }
}

/* Celulares pequeños (480px) */
@media (max-width: 480px) {
    .navbar {
        flex-direction: column;
        gap: 8px;
        padding: 10px 15px;
    }

    .nav-brand {
        font-size: 16px;
        text-align: center;
        width: 100%;
    }

    .nav-user {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }

    .nav-user span {
        font-size: 12px;
    }

    .btn-logout {
        padding: 6px 10px;
        font-size: 12px;
    }

    .content-area {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-card h3 {
        font-size: 20px;
    }

    .stat-card p {
        font-size: 11px;
    }

    .menu {
        grid-template-columns: repeat(2, 1fr);
    }

    .menu a {
        padding: 10px 5px;
        font-size: 10px;
    }

    .card {
        padding: 12px;
        margin-bottom: 12px;
    }

    .card h2 {
        font-size: 16px;
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    .card h3 {
        font-size: 14px;
    }

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

    .form-group label {
        font-size: 13px;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 8px;
        font-size: 16px;
    }

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

    .btn-primary,
    .btn-small {
        width: 100%;
        padding: 10px;
        margin-bottom: 10px;
        font-size: 12px;
    }

    .btn-danger {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
        padding: 10px;
        font-size: 12px;
    }

    .data-table {
        font-size: 11px;
        display: block;
        overflow-x: auto;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody,
    .data-table tr {
        display: block;
        margin-bottom: 15px;
    }

    .data-table tr {
        border: 1px solid var(--border-gray);
        border-radius: 4px;
        overflow: hidden;
    }

    .data-table td {
        display: block;
        text-align: right;
        padding: 8px;
        position: relative;
        padding-left: 50%;
    }

    .data-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 50%;
        padding: 8px;
        font-weight: 600;
        text-align: left;
        background: var(--light-gray);
    }

    .data-table td:last-child {
        border-bottom: none;
    }

    .modal-content {
        max-width: 95%;
        padding: 15px;
    }

    .modal-header {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .filter-bar {
        flex-direction: column;
        gap: 8px;
    }

    .filter-btn {
        width: 100%;
        padding: 10px;
    }

    .search-form {
        flex-direction: column;
    }

    .search-form input {
        width: 100%;
        min-width: auto;
        margin-bottom: 8px;
    }

    .search-form button {
        width: 100%;
    }

    .info-table {
        font-size: 12px;
    }

    .info-table td {
        padding: 8px 5px;
    }

    .info-table td:first-child {
        width: 45%;
        padding-left: 5px;
    }

    .info-table code {
        font-size: 10px;
        padding: 1px 4px;
    }

    .activity-item {
        gap: 10px;
        margin-bottom: 15px;
    }

    .activity-time {
        min-width: 45px;
        font-size: 11px;
    }

    .activity-content p {
        font-size: 12px;
        margin: 3px 0;
    }

    .activity-content small {
        font-size: 10px;
    }

    .pagination {
        gap: 5px;
    }

    .pagination a,
    .pagination span {
        padding: 5px 8px;
        font-size: 12px;
    }

    .badge {
        font-size: 10px;
        padding: 3px 6px;
    }

    .btn-icon {
        padding: 3px 5px;
        font-size: 16px;
    }

    h1 {
        font-size: 18px;
        margin-bottom: 15px;
    }

    h2 {
        font-size: 16px;
    }

    h3 {
        font-size: 14px;
    }

    /* Video de cámara responsive */
    #video,
    .camera-container {
        width: 100%;
    }

    .camera-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Grid de fotos responsive */
    #preview-container,
    [style*="grid-template-columns"] {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 10px;
    }
}

/* Celulares muy pequeños (320px - 380px) */
@media (max-width: 380px) {
    .navbar {
        padding: 8px 10px;
    }

    .nav-brand {
        font-size: 14px;
    }

    .nav-user span {
        display: none;
    }

    .content-area {
        padding: 8px;
    }

    .card {
        padding: 10px;
        margin-bottom: 10px;
    }

    .card h2 {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px;
        padding: 8px 6px;
    }

    .btn-primary,
    .btn-small,
    .btn-danger {
        width: 100%;
        padding: 8px;
        font-size: 11px;
    }

    .menu a {
        padding: 8px 3px;
        font-size: 9px;
    }

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

    h1 {
        font-size: 16px;
    }

    table {
        font-size: 10px;
    }
}

/* Click-to-Call Phone Link */
.phone-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.phone-link:hover {
    background: linear-gradient(135deg, #218838, #1aa179);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
    color: white;
}

.phone-link:active {
    transform: translateY(0);
}

.phone-link i {
    font-size: 18px;
}

/* Phone link small (for tables) */
.phone-link-small {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.phone-link-small:hover {
    background: linear-gradient(135deg, #218838, #1aa179);
    transform: scale(1.05);
    color: white;
}

.phone-link-small i {
    font-size: 12px;
}
