/* 
    Sistema de Gestión Toldos de la Costa
    Estilo: Rojo y Negro (Brand Identity)
    Concepto: Minimalista / Prolijo / Premium
*/

:root {
    --brand-red: #CA0606;
    --brand-red-hover: #FF0101;
    --brand-black: #020101;
    --brand-dark-gray: #1a1a1a;
    --bg-body: #f8f9fa;
    --bg-card: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --sidebar-width-full: 260px;
    --sidebar-width-mini: 70px;
    --header-height: 60px;
    --border-radius: 8px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Jost', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar General (Flex Item) */
aside.sidebar {
    width: var(--sidebar-width-full);
    height: 100%;
    background-color: var(--brand-black);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    flex-shrink: 0;
}

/* Modo Colapsado */
aside.sidebar.collapsed {
    width: var(--sidebar-width-mini);
}

.sidebar-header {
    padding: 25px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.sidebar-logo-link {
    display: block;
    transition: transform 0.3s ease;
}

.sidebar-logo-link img {
    max-width: 170px;
    height: auto;
    display: block;
    transition: max-width 0.3s ease;
}

aside.sidebar.collapsed .sidebar-logo-link img {
    max-width: 45px;
}

.toggle-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255,255,255,0.08);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
    border: 1px solid rgba(255,255,255,0.1);
}

aside.sidebar.collapsed .toggle-btn {
    right: 50%;
    transform: translateX(50%);
    top: 10px;
}

.toggle-btn:hover {
    background: var(--brand-red);
    transform: scale(1.1);
}

.sidebar-nav {
    flex: 1;
    padding: 15px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
    border-left: 4px solid transparent;
    white-space: nowrap;
    font-size: 0.9rem;
}

/* Push Content Adjustment - PURE FLEXBOX */
main.main-content {
    flex: 1;
    background-color: var(--bg-body);
    height: 100vh;
    overflow-y: auto;
    position: relative;
    padding: 40px; /* Margen de seguridad para el contenido */
    transition: all 0.3s ease;
    min-width: 0;
}

/* Sidebar Scrollbar Styling */
.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

/* Tablet & Mobile Responsiveness */
@media (max-width: 1024px) {
    aside.sidebar {
        width: var(--sidebar-width-mini);
    }
    aside.sidebar .nav-item span,
    aside.sidebar .sidebar-logo-link img {
        display: none;
    }
    aside.sidebar.collapsed {
        width: 0;
        visibility: hidden;
    }
}

/* Task Edit Button style */
.task-card {
    position: relative;
}

.edit-task-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f1f1f1;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.task-card:hover .edit-task-btn {
    opacity: 1;
}

.edit-task-btn:hover {
    background: #e2e2e2;
    color: var(--brand-red);
}

.nav-item i {
    min-width: 20px;
    margin-right: 20px;
    text-align: center;
    font-size: 1.1rem;
    transition: margin 0.3s;
}

aside.sidebar.collapsed .nav-item i {
    margin-right: 0;
}

aside.sidebar.collapsed .nav-item {
    padding-left: 21px; /* Centrar icono visualmente */
}

.nav-item span {
    opacity: 1;
    transition: opacity 0.2s;
}

aside.sidebar.collapsed .nav-item span {
    opacity: 0;
    pointer-events: none;
}

.nav-item:hover {
    color: white;
    background: rgba(255,255,255,0.05);
}

.nav-item.active {
    color: white;
    background: rgba(202, 6, 6, 0.1);
    border-left-color: var(--brand-red);
}

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

/* Main Content Area */
main.main-content {
    flex: 1;
    margin-left: var(--sidebar-width-full);
    background-color: var(--bg-body);
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

main.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-width-mini);
}
main.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Header */
header.top-header {
    height: var(--header-height);
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 900;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Page Container */
.content-wrapper {
    padding: 30px;
    width: 100%;
    margin: 0;
}

.page-title {
    margin-bottom: 25px;
}

.page-title h1 {
    font-size: 1.8rem;
    color: var(--brand-black);
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 25px;
    border: 1px solid rgba(0,0,0,0.05);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background-color: var(--brand-red-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(202, 6, 6, 0.3);
}

.btn-dark {
    background-color: var(--brand-black);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid #ddd;
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--brand-red);
    color: var(--brand-red);
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-muted);
}

input[type="text"],
input[type="number"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 11px 15px;
    border-radius: var(--border-radius);
    border: 1px solid #ddd;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--brand-red);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-bottom: 2px solid #eee;
}

td {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success { background: #e6f7ed; color: #15803d; }
.badge-warning { background: #fffbeb; color: #b45309; }
.badge-danger { background: #fee2e2; color: #dc2626; }

/* Responsive */
@media (max-width: 768px) {
    aside.sidebar {
        width: 70px;
    }
    .sidebar-logo, .nav-item span, .user-info {
        display: none;
    }
    main.main-content {
        margin-left: 70px;
    }
    .nav-item {
        justify-content: center;
        padding: 15px 0;
    }
    .nav-item i {
        margin-right: 0;
        font-size: 1.2rem;
    }
}
/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

/* Dashboard Link Cards */
.card-link {
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}

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