/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0073ea;
    --primary-hover: #005bb5;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --white: #ffffff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --border-radius: 0.375rem;
    --border-radius-lg: 0.5rem;
    --border-radius-xl: 0.75rem;
    --transition: all 0.15s ease-in-out;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--gray-800);
    line-height: 1.6;
    font-size: 14px;
    min-height: 100vh;
}

/* Contenedor principal */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--white);
    border-radius: var(--border-radius-xl);
    margin: 1rem;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: relative;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-100) 100%);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 2rem;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    position: relative;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color));
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.logo:hover {
    transform: translateY(-1px);
    color: var(--primary-hover);
}

.logo i {
    font-size: 28px;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-center {
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
}

.search-bar {
    position: relative;
    width: 100%;
}

.search-bar i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #8b9dc3;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-xl);
    font-size: 14px;
    background: var(--white);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(0, 115, 234, 0.1);
    transform: translateY(-1px);
}

.search-bar input::placeholder {
    color: var(--gray-500);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: var(--white);
    border: none;
    padding: 12px 20px;
    border-radius: var(--border-radius-lg);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
    padding: 10px 16px;
    border-radius: var(--border-radius-lg);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--gray-100);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    border: 3px solid var(--white);
}

.user-avatar:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow);
}

/* Layout principal */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--white) 0%, var(--gray-100) 100%);
    border-right: 1px solid var(--gray-200);
    padding: 2rem 0;
    height: 100%;
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--gray-600);
    font-weight: 500;
    position: relative;
    margin: 4px 16px;
    border-radius: var(--border-radius-lg);
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--gray-800);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    color: var(--white);
    box-shadow: var(--shadow);
    transform: translateX(8px);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 0 2px 2px 0;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

/* Contenido principal */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: row;
    height: calc(100vh - 70px);
    overflow: hidden;
    background: var(--gray-100);
    min-height: 0;
}

.board-header {
    padding: 2rem 2.5rem;
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-100) 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.board-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.board-actions {
    display: flex;
    gap: 10px;
}

/* Contenedor del tablero */
.board-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--gray-100);
    position: relative;
}

.board-scroll {
    flex: 1;
    overflow: auto;
    padding: 2rem 2.5rem;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--white) 100%);
}

/* Headers de columnas */
.column-headers {
    display: grid;
    grid-template-columns: 320px repeat(5, 160px);
    gap: 16px;
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-100) 100%);
    padding: 20px 24px;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    border: 1px solid var(--gray-200);
}

.column-header {
    font-weight: 700;
    color: var(--gray-700);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.column-header.sticky {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 101;
}

/* Grupos */
.groups-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.group {
    background: var(--white);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.group:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.group-header {
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.group-header:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--info-color) 100%);
    color: var(--white);
}

.group-header i {
    color: var(--gray-600);
    transition: var(--transition);
    font-size: 16px;
}

.group-header:hover i {
    color: var(--white);
    transform: scale(1.1);
}

.group-header span:first-of-type {
    font-weight: 700;
    color: var(--gray-800);
    font-size: 16px;
    transition: var(--transition);
}

.group-header:hover span:first-of-type {
    color: var(--white);
}

.group-count {
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    color: var(--white);
    padding: 6px 12px;
    border-radius: var(--border-radius-xl);
    font-size: 12px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--white);
}

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

/* Elementos del tablero */
.board-item {
    display: grid;
    grid-template-columns: 320px repeat(5, 160px);
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    transition: var(--transition);
    align-items: center;
    background: var(--white);
    position: relative;
}

.board-item:hover {
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-100) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

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

.board-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: transparent;
    transition: var(--transition);
}

.board-item:hover::before {
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
}

.item-name {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 15px;
    line-height: 1.4;
}

.item-status {
    display: flex;
    align-items: center;
}

.status-badge {
    padding: 8px 16px;
    border-radius: var(--border-radius-xl);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
    transition: var(--transition);
    cursor: pointer;
}

.status-badge:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

.status-pending {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border-color: #ffeaa7;
}

.status-in-progress {
    background: linear-gradient(135deg, #cce5ff, #74b9ff);
    color: #0066cc;
    border-color: #74b9ff;
}

.status-completed {
    background: linear-gradient(135deg, #d4edda, #00b894);
    color: #155724;
    border-color: #00b894;
}

.item-assigned {
    display: flex;
    align-items: center;
}

.avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
    border: 3px solid var(--white);
    transition: var(--transition);
}

.avatar:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow);
}

.item-date {
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 500;
    background: var(--gray-100);
    padding: 6px 12px;
    border-radius: var(--border-radius);
    text-align: center;
}

.item-priority {
    display: flex;
    align-items: center;
}

.priority-high {
    color: var(--danger-color);
    font-weight: 700;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.priority-medium {
    color: var(--warning-color);
    font-weight: 700;
    background: linear-gradient(135deg, #fdcb6e, #e17055);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.priority-low {
    color: var(--success-color);
    font-weight: 700;
    background: linear-gradient(135deg, #00b894, #00cec9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.item-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    border-radius: var(--border-radius-xl);
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.item-progress span {
    font-size: 12px;
    color: var(--gray-600);
    min-width: 40px;
    text-align: right;
    font-weight: 600;
    background: var(--gray-100);
    padding: 4px 8px;
    border-radius: var(--border-radius);
}

/* Responsive */
@media (max-width: 1200px) {
    .app-container {
        margin: 0.5rem;
    }
    
    .sidebar {
        width: 240px;
    }
    
    .column-headers,
    .board-item {
        grid-template-columns: 280px repeat(5, 140px);
    }
}

@media (max-width: 768px) {
    .app-container {
        margin: 0;
        border-radius: 0;
        height: 100vh;
    }
    
    .sidebar {
        display: none;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .header {
        padding: 0 1rem;
        height: 60px;
    }
    
    .header-center {
        display: none;
    }
    
    .board-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
        padding: 1.5rem;
    }
    
    .board-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .column-headers,
    .board-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .column-header,
    .board-item > div {
        padding: 8px;
        border-bottom: 1px solid var(--gray-200);
        background: var(--white);
        border-radius: var(--border-radius);
        margin-bottom: 4px;
    }
    
    .board-scroll {
        padding: 1rem;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.board-item {
    animation: fadeIn 0.5s ease;
}

.group {
    animation: slideIn 0.4s ease;
}

/* Efectos de hover mejorados */
.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Estados de arrastrar */
.board-item.dragging {
    opacity: 0.7;
    transform: rotate(3deg) scale(1.02);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.board-item.drag-over {
    border-top: 4px solid var(--primary-color);
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Scrollbar personalizado */
.board-scroll::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.board-scroll::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: var(--border-radius-xl);
}

.board-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--gray-400), var(--gray-500));
    border-radius: var(--border-radius-xl);
    border: 2px solid var(--gray-100);
}

.board-scroll::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
}

.board-scroll::-webkit-scrollbar-corner {
    background: var(--gray-100);
}

/* Modal de configuración */
.modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0,0,0,0.7), rgba(0,0,0,0.5));
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-100) 100%);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    animation: fadeIn 0.3s ease;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    color: var(--white);
    border-radius: var(--border-radius-xl) var(--border-radius-xl) 0 0;
}

.modal-header h3 {
    margin: 0;
    color: var(--white);
    font-size: 20px;
    font-weight: 700;
}

.close {
    color: var(--white);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
}

.close:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

.modal-body {
    padding: 24px;
}

.modal-body ol {
    margin: 20px 0;
    padding-left: 24px;
}

.modal-body ol li {
    margin: 12px 0;
    color: var(--gray-700);
    font-weight: 500;
    line-height: 1.6;
}

.modal-body a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.modal-body a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--gray-800);
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    font-size: 14px;
    transition: var(--transition);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 115, 234, 0.1);
    transform: translateY(-1px);
}

.form-group input::placeholder {
    color: var(--gray-500);
    font-weight: 500;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: var(--gray-100);
    border-radius: 0 0 var(--border-radius-xl) var(--border-radius-xl);
}

/* Estados de sincronización */
#syncBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--gray-300);
    color: var(--gray-500);
}

#syncBtn:disabled:hover {
    background: var(--gray-300);
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* Indicador de sincronización */
.sync-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, var(--success-color), #00b894);
    color: var(--white);
    padding: 12px 20px;
    border-radius: var(--border-radius-xl);
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    border: 2px solid var(--white);
    animation: slideIn 0.3s ease;
}

.sync-indicator.syncing {
    background: linear-gradient(135deg, var(--warning-color), #fdcb6e);
    color: var(--gray-800);
}

.sync-indicator.error {
    background: linear-gradient(135deg, var(--danger-color), #ff6b6b);
    color: var(--white);
}
