/* ============================================
   RenderCore - CSS Responsivo
   100% Responsive Design para todos los dispositivos
   ============================================ */

/* --- Pantallas grandes pero no máximas (hasta 1200px) --- */
@media screen and (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 0 1.5rem;
    }

    .three-column-layout {
        grid-template-columns: 260px 1fr 300px;
        gap: 1.5rem;
    }
}

/* --- Tablets grandes (hasta 1024px) --- */
@media screen and (max-width: 1024px) {
    .container {
        padding: 0 1rem;
    }

    /* Layout cambia a 2 columnas: centro y derecha */
    .three-column-layout {
        grid-template-columns: 1fr 300px;
        gap: 1.5rem;
    }

    /* Sidebar izquierda se oculta en tablets */
    .left-sidebar {
        display: none;
    }

    .widget {
        padding: 1.2rem;
    }

    .project-carousel {
        height: 280px;
    }

    .right-sidebar {
        position: sticky;
        top: 90px;
        max-height: calc(100vh - 110px);
        overflow-y: auto;
    }

    /* Dropdown del perfil responsive */
    .profile-dropdown {
        right: 10px;
        width: 260px;
    }

    .profile-dropdown-header {
        padding: 1.25rem;
    }

    .user-avatar-small {
        width: 45px;
        height: 45px;
        font-size: 1.75rem;
    }
}

/* --- Tablets medianas (hasta 900px) --- */
@media screen and (max-width: 900px) {
    .three-column-layout {
        grid-template-columns: 1fr 280px;
        gap: 1rem;
    }

    .project-carousel {
        height: 260px;
    }

    .widget h3 {
        font-size: 1rem;
    }

    .right-sidebar .widget {
        padding: 1rem;
    }

    .news-item {
        padding: 0.8rem;
    }

    .stat-item {
        padding: 1.2rem 0.8rem;
    }
}

/* --- Tablets en vertical (hasta 768px) --- */
@media screen and (max-width: 768px) {
    .header {
        height: 60px;
    }

    .header-container {
        padding: 0 0.8rem;
    }

    .logo img {
        height: 32px;
    }

    .menu-toggle,
    .profile-btn {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }

    .main-content {
        margin-top: 60px;
        padding: 0.8rem;
    }

    /* Sidebar - Logo más pequeño en tablets */
    .sidebar-logo {
        height: 20px;
    }

    /* Layout en una sola columna */
    .three-column-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Ocultar sidebar derecha en tablets y móvil */
    .right-sidebar {
        display: none !important;
    }

    /* Dropdown del perfil en móvil */
    .profile-dropdown {
        right: 5px;
        left: 5px;
        width: auto;
    }

    .content-header h1,
    .content-header h2 {
        font-size: 1.6rem;
    }

    .content-header p {
        font-size: 1rem;
    }

    .project-card {
        margin-bottom: 1rem;
    }

    .project-carousel {
        height: 240px;
    }

    .project-title {
        font-size: 1.2rem;
    }

    .project-content {
        padding: 1.2rem;
    }

    .project-description {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .project-technologies {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .tech-tag {
        font-size: 0.8rem;
        padding: 0.3rem 0.7rem;
    }

    .project-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .project-meta {
        width: 100%;
    }

    /* Admin grid ajustado */
    .admin-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

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

    .stat-card-large {
        padding: 1.5rem;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .stat-content h3 {
        font-size: 1.5rem;
    }

    /* Tablas responsivas */
    .table-container {
        overflow-x: auto;
    }

    .data-table {
        font-size: 0.9rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.8rem;
        white-space: nowrap;
    }

    /* Conversaciones en columna única */
    .conversations-grid {
        grid-template-columns: 1fr;
    }

    .conversations-list {
        max-height: 300px;
        overflow-y: auto;
    }

    /* Modal ajustado */
    .modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .modal-header {
        padding: 1.2rem 1.5rem;
    }

    .modal-body {
        padding: 1.5rem;
    }
}

/* --- Móviles (hasta 640px) --- */
@media screen and (max-width: 640px) {
    /* Header móvil */
    .header {
        height: 56px;
    }

    .header-container {
        padding: 0 0.6rem;
    }

    .menu-toggle,
    .profile-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .logo img {
        height: 28px;
    }

    .main-content {
        margin-top: 56px;
        padding: 0.6rem;
    }

    /* Sidebar en móvil */
    .sidebar {
        width: 280px;
        left: -280px;
    }

    .sidebar-header {
        padding: 1rem;
    }

    .sidebar-logo {
        height: 18px;
    }

    .user-info {
        padding: 1.5rem 1rem;
    }

    /* Dropdown de perfil responsivo */
    .profile-dropdown {
        right: 10px;
        width: 260px;
    }

    .profile-dropdown-header {
        padding: 1.25rem;
    }

    .user-avatar-small {
        width: 45px;
        height: 45px;
        font-size: 1.75rem;
    }

    .user-avatar {
        font-size: 3rem;
    }

    .user-info h3 {
        font-size: 1rem;
    }

    .sidebar-menu a {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }

    .sidebar-menu a i {
        font-size: 1.1rem;
        margin-right: 0.8rem;
    }

    /* Contenido principal */
    .main-content {
        margin-top: 60px;
        min-height: calc(100vh - 60px);
        padding: 0.5rem 0.5rem;
    }

    /* Layout en una sola columna */
    .three-column-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Sidebar derecha oculta en móvil */
    .right-sidebar {
        display: none !important;
    }

    /* Widgets más compactos */
    .widget {
        padding: 1rem;
        border-radius: 10px;
    }

    .widget h3 {
        font-size: 1rem;
        margin-bottom: 0.8rem;
    }

    /* Dashboard header */
    .dashboard-header {
        margin-bottom: 1.5rem;
    }

    .dashboard-header h1 {
        font-size: 1.5rem;
    }

    .dashboard-header p {
        font-size: 0.9rem;
    }

    .content-header h1,
    .content-header h2 {
        font-size: 1.4rem;
    }

    .content-header p {
        font-size: 0.9rem;
    }

    /* Proyectos */
    .projects-container {
        gap: 1.5rem;
    }

    .project-card {
        border-radius: 12px;
    }

    .project-carousel {
        height: 200px;
    }

    .carousel-btn {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }

    .carousel-btn.prev {
        left: 5px;
    }

    .carousel-btn.next {
        right: 5px;
    }

    .carousel-indicators {
        bottom: 10px;
    }

    .indicator {
        width: 8px;
        height: 8px;
    }

    .indicator.active {
        width: 24px;
    }

    .project-content {
        padding: 1rem;
    }

    .project-header {
        flex-direction: column;
        align-items: start;
        gap: 0.8rem;
    }

    .project-title {
        font-size: 1.1rem;
    }

    .project-category {
        align-self: flex-start;
    }

    .project-description {
        font-size: 0.9rem;
    }

    .project-technologies {
        gap: 0.4rem;
    }

    .tech-tag {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }

    .project-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .project-meta {
        flex-direction: column;
        gap: 0.5rem;
        font-size: 0.85rem;
    }

    /* Botones */
    .btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }

    /* Accesos rápidos */
    .quick-link {
        padding: 0.8rem;
        gap: 0.8rem;
    }

    .quick-link i {
        font-size: 1.3rem;
    }

    .quick-link span {
        font-size: 0.9rem;
    }

    /* Categorías */
    .categories {
        gap: 0.4rem;
    }

    .category-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    /* Features list */
    .features-list li {
        padding: 0.6rem 0;
        font-size: 0.9rem;
    }

    .features-list i {
        font-size: 1rem;
    }

    /* Novedades */
    .news-item {
        padding: 0.8rem;
        gap: 0.8rem;
    }

    .news-icon {
        font-size: 1.5rem;
    }

    .news-content h4 {
        font-size: 0.9rem;
    }

    .news-content p {
        font-size: 0.8rem;
    }

    /* Estadísticas */
    .stats {
        gap: 1rem;
    }

    .stat-item {
        padding: 1.2rem 0.8rem;
    }

    .stat-number {
        font-size: 1.8rem;
    }

    .stat-label {
        font-size: 0.85rem;
    }

    /* Tip box */
    .tip-box {
        padding: 1.2rem;
        color: #ffffff !important; /* Mantener texto blanco en móvil */
    }

    .tip-box p {
        font-size: 0.9rem;
        color: #ffffff !important; /* Texto blanco en móvil */
    }

    .tip-author {
        color: rgba(255, 255, 255, 0.95) !important; /* Autor visible en móvil */
    }

    /* Footer */
    .footer {
        padding: 1.5rem 1rem;
        margin-top: 3rem;
    }

    .footer-logo img {
        height: 45px;
    }

    .footer-info p {
        font-size: 0.9rem;
    }

    .social-links a {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }

    /* Modal en móvil */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 12px;
    }

    .modal-header {
        padding: 1rem 1.2rem;
    }

    .modal-header h2 {
        font-size: 1.2rem;
    }

    .close-modal {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }

    .modal-body {
        padding: 1.2rem;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }

    /* Formularios */
    .form-group {
        margin-bottom: 1.2rem;
    }

    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 0.7rem 0.9rem;
        font-size: 0.95rem;
    }

    .help-text {
        font-size: 0.8rem;
    }

    /* Autenticación */
    .auth-page {
        padding: 1.5rem 0.8rem;
    }

    .auth-box {
        padding: 2rem 1.5rem;
        border-radius: 16px;
    }

    .auth-logo img {
        height: 30px;
    }

    .auth-box h1 {
        font-size: 1.5rem;
    }

    .auth-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .checkbox-label {
        font-size: 0.9rem;
    }

    .forgot-password {
        font-size: 0.85rem;
    }

    .btn-social {
        padding: 0.7rem;
        font-size: 0.9rem;
    }

    .auth-footer {
        font-size: 0.9rem;
    }

    .back-home {
        font-size: 0.9rem;
    }

    /* Dashboard específico */
    .user-stats {
        gap: 0.8rem;
    }

    .stat-card {
        padding: 0.8rem;
    }

    .stat-card i {
        font-size: 1.8rem;
    }

    /* Admin panel */
    .admin-stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card-large {
        padding: 1.2rem;
        gap: 1rem;
    }

    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }

    .stat-content h3 {
        font-size: 1.3rem;
    }

    .stat-content p {
        font-size: 0.85rem;
    }

    .admin-card {
        padding: 1.2rem;
    }

    .admin-card h3 {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    /* Tablas en móvil - scroll horizontal */
    .table-container {
        border-radius: 10px;
    }

    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.6rem;
        font-size: 0.8rem;
    }

    /* Búsqueda y filtros */
    .header-actions {
        flex-direction: column;
        width: 100%;
    }

    .search-input,
    .filter-select {
        width: 100%;
        padding: 0.7rem 0.9rem;
        font-size: 0.9rem;
    }

    /* Conversaciones */
    .conversations-grid {
        gap: 1rem;
    }

    .conversations-list,
    .conversation-detail {
        padding: 1rem;
    }

    /* Contratos */
    .contracts-list {
        gap: 1rem;
    }

    .contract-card {
        padding: 1rem;
        border-radius: 10px;
    }

    /* Formulario de upload */
    .upload-form {
        padding: 1.2rem;
        border-radius: 10px;
    }

    .image-upload-area {
        padding: 2rem 1rem;
        border-width: 2px;
    }

    .image-upload-area i {
        font-size: 2.5rem;
    }

    .image-upload-area p {
        font-size: 0.9rem;
    }

    .image-upload-area small {
        font-size: 0.75rem;
    }

    .image-preview-container {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.8rem;
    }

    .remove-image {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }

    /* Empty states */
    .empty-state {
        padding: 1.5rem;
        font-size: 0.9rem;
    }

    /* Load more */
    .load-more-container {
        margin: 1.5rem 0;
    }

    .btn-load-more {
        width: 100%;
    }
}

/* --- Móviles pequeños (hasta 480px) --- */
@media screen and (max-width: 480px) {
    .header {
        height: 54px;
    }

    .header-container {
        padding: 0 0.5rem;
    }

    .menu-toggle,
    .profile-btn {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }

    .logo img {
        height: 26px;
    }

    .sidebar {
        width: 260px;
        left: -260px;
    }

    .sidebar-logo {
        height: 16px;
    }

    .main-content {
        margin-top: 54px;
        padding: 0.5rem 0.4rem;
    }

    .container {
        padding: 0 0.5rem;
    }

    /* Asegurar que sidebar derecha NO se muestre en móvil */
    .right-sidebar {
        display: none !important;
    }

    .widget {
        padding: 0.8rem;
    }

    .widget h3 {
        font-size: 0.95rem;
    }

    .project-carousel {
        height: 180px;
    }

    .carousel-btn {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .project-content {
        padding: 0.8rem;
    }

    .project-title {
        font-size: 1rem;
    }

    .project-description {
        font-size: 0.85rem;
    }

    .tech-tag {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .auth-box {
        padding: 1.5rem 1rem;
    }

    .auth-box h1 {
        font-size: 1.3rem;
    }

    .modal-content {
        width: 98%;
    }

    .modal-header h2 {
        font-size: 1.1rem;
    }

    .stat-card-large {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
    }

    .stat-content h3 {
        font-size: 1.5rem;
    }
}

/* --- Pantallas extra grandes (1440px+) --- */
@media screen and (min-width: 1440px) {
    .container {
        max-width: 1600px;
    }

    .three-column-layout {
        grid-template-columns: 320px 1fr 360px;
        gap: 2.5rem;
    }

    .project-carousel {
        height: 350px;
    }

    .content-header h1,
    .content-header h2 {
        font-size: 2.5rem;
    }

    .project-title {
        font-size: 1.6rem;
    }

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

/* --- Modo paisaje en tablets --- */
@media screen and (max-width: 1024px) and (orientation: landscape) {
    .three-column-layout {
        grid-template-columns: 200px 1fr 250px;
    }

    .sidebar {
        width: 280px;
        left: -280px;
    }

    .project-carousel {
        height: 220px;
    }
}

/* --- Ajustes para impresión --- */
@media print {
    .header,
    .sidebar,
    .footer,
    .overlay,
    .modal,
    .menu-toggle,
    .profile-btn,
    .btn {
        display: none !important;
    }

    .main-content {
        margin-top: 0;
        padding: 0;
    }

    .three-column-layout {
        display: block;
    }

    .project-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* --- Accesibilidad: Reducir animaciones --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- Modo oscuro (si el sistema lo prefiere) --- */
@media (prefers-color-scheme: dark) {
    :root {
        --light-bg: #1e293b;
        --card-bg: #0f172a;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --border-color: #334155;
    }

    .auth-page {
        background: linear-gradient(135deg, #1e293b, #0f172a);
    }

    .footer-logo img {
        filter: brightness(0) invert(1);
    }
}

