/* ========================================
   RESET & BASE STYLES
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
input,
textarea,
select {
    width: 100%;
    padding: 18px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 500;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
}

input[readonly] {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

label {
    display: block;
    margin-bottom: 5px;
    color: #2c3e50;
    font-weight: 500;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.checkbox-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    margin-bottom: 10px;
}

/* Switch styles */
.switch-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: #2c3e50;
    margin: 8px 0;
    cursor: pointer;
}

.switch-label input[type="checkbox"] {
    display: none;
}

.switch-slider {
    position: relative;
    width: 6.5625em;
    height: 2.125em;
    background-color: #f44336; /* red for inactive */
    border-radius: 2.125em;
    transition: background-color 0.4s;
    cursor: pointer;
}

.switch-slider::before {
    content: "";
    position: absolute;
    height: 1.625em;
    width: 1.625em;
    left: 0.25em;
    bottom: 0.25em;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.4s;
}

.switch-label input:checked + .switch-slider {
    background-color: #4CAF50; /* green for active */
}

.switch-label input:checked + .switch-slider::before {
    transform: translateX(4.4em);
}

.switch-text {
    display: none;
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
}

.switch-label input:checked + .switch-slider .active {
    display: block;
    color: white;
    position: absolute;
    left: 1em;
    top: 50%;
    transform: translateY(-50%);
}

.switch-label input:not(:checked) + .switch-slider .inactive {
    display: block;
    color: white;
    position: absolute;
    right: 1em;
    top: 50%;
    transform: translateY(-50%);
}

/* Asterisco rojo para campos obligatorios */
.required-asterisk {
    color: #e74c3c;
    margin-left: 3px;
    font-weight: bold;
}

/* ========================================
   SIDEBAR STYLES
   ======================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: #1B1B1F;
    color: #F5F5F5;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'IBM Plex Sans', sans-serif;
}

.sidebar-header h2 i {
    font-size: 28px;
}

.sidebar-menu {
    padding: 20px 0;
}

.menu-section {
    margin-bottom: 25px;
}

.menu-section-title {
    padding: 0 20px;
    font-size: 11px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    font-family: 'IBM Plex Sans', sans-serif;
}

.menu-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    font-family: 'IBM Plex Sans', sans-serif;
}

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

.menu-item.active {
    background-color: #995a2c;
    color: white;
    border-right: 3px solid #F39539;
}

.menu-item i {
    width: 20px;
    font-size: 18px;
    color: #FFD8A8;
}

.menu-item .badge {
    margin-left: auto;
    background-color: #ef4444;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

/* ========================================
   TOP NAVIGATION BAR
   ======================================== */
.topbar {
    position: fixed;
    left: 260px;
    top: 0;
    right: 0;
    height: 70px;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 999;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-toggle {
    display: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 350px;
    padding: 10px 40px 10px 15px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.search-box input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-box i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 25px;
}

.topbar-icon {
    position: relative;
    cursor: pointer;
    color: #6b7280;
    font-size: 20px;
    transition: color 0.3s ease;
}

.topbar-icon:hover {
    color: #3b82f6;
}

.topbar-icon .badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background-color: #ef4444;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.user-profile:hover {
    background-color: #f3f4f6;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0B0B0B 0%, #141414 45%, #9A3412 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.user-role {
    font-size: 12px;
    color: #6b7280;
}

/* ========================================
   MAIN CONTENT AREA
   ======================================== */
.main-content {
    margin-left: 260px;
    margin-top: 70px;
    padding: 30px;
    min-height: calc(100vh - 70px);
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
    font-family: 'Montserrat', sans-serif;
}

.breadcrumb {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 14px;
    color: #6b7280;
}

.breadcrumb a {
    color: #3b82f6;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ========================================
   STATS CARDS
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.stat-icon.green {
    background: linear-gradient(135deg, #10b981, #059669);
}

.stat-icon.purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.stat-info h3 {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
}

.stat-change {
    font-size: 12px;
    margin-top: 6px;
}

.stat-change.positive {
    color: #10b981;
}

.stat-change.negative {
    color: #ef4444;
}

/* ========================================
   CARDS & CONTENT GRID
   ======================================== */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.content-grid.full-width {
    grid-template-columns: 1fr;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    font-family: 'Montserrat', sans-serif;
}

.card-header .btn-link {
    color: #3b82f6;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.card-header .btn-link:hover {
    text-decoration: underline;
}

.card-body {
    padding: 24px;
}

/* ========================================
   TABLE STYLES
   ======================================== */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    text-align: left;
    padding: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    font-family: 'IBM Plex Sans', sans-serif;
}

table td {
    padding: 16px 12px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    color: #1f2937;
    transition: color 0.3s ease;
}

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

/* Hover effect for table rows */
table tbody tr {
    transition: background-color 0.5s ease;
}

table tbody tr:hover {
    background-color: #f3f4f6;
}

table tbody tr:hover .status-badge {
    background-color: #fff;
    color: #333;
}

/* Table Sorting */
table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px;
}

table th.sortable:hover {
    color: #3b82f6;
}

table th.sortable::after {
    content: '\f0dc';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 8px;
    opacity: 0.3;
    font-size: 10px;
}

table th.sortable.asc::after {
    content: '\f0de';
    opacity: 1;
    color: #3b82f6;
}

table th.sortable.desc::after {
    content: '\f0dd';
    opacity: 1;
    color: #3b82f6;
}

/* Table styles for contacts */
.table-container th:nth-child(-n+5),
.table-container td:nth-child(-n+5) {
    text-align: left;
    width: calc(70% / 5);
}

.table-container th:last-child,
.table-container td:last-child {
    text-align: right;
    width: 30%;
}

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-badge.active {
    background-color: #d1fae5;
    color: #065f46;
}

.status-badge.pending {
    background-color: #fef3c7;
    color: #92400e;
}

.status-badge.closed {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-badge.status-available {
    background-color: #d1fae5;
    color: #065f46;
}

.status-badge.status-sold {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-badge.status-out-of-stock {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Radio Button Group */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 400;
}

.radio-label input[type="radio"] {
    margin: 0 8px 0 0;
    cursor: pointer;
}

.radio-text {
    user-select: none;
}

/* iOS Style Switch */
.ios-switch-container {
    margin-top: 8px;
}

.ios-switch-checkbox {
    display: none;
}

.ios-switch-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.ios-switch-button {
    position: relative;
    width: 50px;
    height: 28px;
    background: #e5e5ea;
    border-radius: 14px;
    margin-right: 12px;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ios-switch-button::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ios-switch-text {
    font-size: 14px;
    color: #8e8e93;
    transition: all 0.3s ease;
}

.ios-switch-text-available {
    color: #34c759;
}

.ios-switch-text-out-of-stock {
    color: #ff3b30;
}

/* Switch States */
.ios-switch-checkbox:checked + .ios-switch-label .ios-switch-button {
    background: #34c759;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ios-switch-checkbox:checked + .ios-switch-label .ios-switch-button::before {
    transform: translateX(22px);
}

.ios-switch-checkbox:checked + .ios-switch-label .ios-switch-text-available {
    color: #34c759;
    opacity: 1;
}

.ios-switch-checkbox:checked + .ios-switch-label .ios-switch-text-out-of-stock {
    color: #8e8e93;
    opacity: 0.5;
}

.ios-switch-checkbox:not(:checked) + .ios-switch-label .ios-switch-text-out-of-stock {
    color: #ff3b30;
    opacity: 1;
}

.ios-switch-checkbox:not(:checked) + .ios-switch-label .ios-switch-text-available {
    color: #8e8e93;
    opacity: 0.5;
}

/* Hover Effects */
.ios-switch-label:hover .ios-switch-button {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.ios-switch-checkbox:checked + .ios-switch-label:hover .ios-switch-button {
    background: #28a745;
}

/* ========================================
   iOS RADIO BUTTONS
   ======================================== */
.ios-radio-group {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 8px;
}

.ios-radio-input {
    display: none;
}

.ios-radio-label {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    font-size: 16px;
    color: #8e8e93;
    transition: all 0.3s ease;
    padding: 8px;
    border-radius: 8px;
}

.ios-radio-label::before {
    content: '';
    position: relative;
    width: 22px;
    height: 22px;
    border: 2px solid #c7c7cc;
    border-radius: 50%;
    margin-right: 10px;
    background: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    transform: scale(1);
}

.ios-radio-label::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ios-radio-input:checked + .ios-radio-label {
    color: #007aff;
    background-color: rgba(0, 122, 255, 0.1);
}

.ios-radio-input:checked + .ios-radio-label::before {
    border-color: #007aff;
    background: #007aff;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
    animation: radioSelect 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ios-radio-input:checked + .ios-radio-label::after {
    opacity: 1;
    transform: translateY(-50%) rotate(45deg) scale(1);
    animation: checkmarkAppear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover Effects */
.ios-radio-label:hover {
    background-color: rgba(0, 122, 255, 0.05);
}

.ios-radio-label:hover::before {
    border-color: #007aff;
    transform: scale(1.05);
}

/* Animations */
@keyframes radioSelect {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.2);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 6px rgba(0, 122, 255, 0.3);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
    }
}

@keyframes checkmarkAppear {
    0% {
        opacity: 0;
        transform: translateY(-50%) rotate(45deg) scale(0);
    }
    50% {
        opacity: 1;
        transform: translateY(-50%) rotate(45deg) scale(1.2);
    }
    100% {
        opacity: 1;
        transform: translateY(-50%) rotate(45deg) scale(1);
    }
}

/* ========================================
   ACTIVITY LIST
   ======================================== */
.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    gap: 15px;
    padding: 16px 0;
    border-bottom: 1px solid #f3f4f6;
}

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

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.activity-icon.blue {
    background-color: #dbeafe;
    color: #1e40af;
}

.activity-icon.green {
    background-color: #d1fae5;
    color: #065f46;
}

.activity-icon.purple {
    background-color: #ede9fe;
    color: #5b21b6;
}

.activity-content {
    flex: 1;
}

.activity-content h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.activity-content p {
    font-size: 13px;
    color: #6b7280;
}

.activity-time {
    font-size: 12px;
    color: #9ca3af;
}

/* ========================================
   DROPDOWN MENUS
   ======================================== */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    min-width: 320px;
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.dropdown-header .mark-read {
    font-size: 12px;
    color: #3b82f6;
    cursor: pointer;
    text-decoration: none;
}

.dropdown-header .mark-read:hover {
    text-decoration: underline;
}

.dropdown-item {
    padding: 14px 20px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dropdown-item:hover {
    background-color: #f9fafb;
}

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

.dropdown-item.unread {
    background-color: #eff6ff;
}

.dropdown-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.dropdown-item-content {
    flex: 1;
}

.dropdown-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.dropdown-item-text {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 4px;
}

.dropdown-item-time {
    font-size: 12px;
    color: #9ca3af;
}

.dropdown-footer {
    padding: 12px 20px;
    text-align: center;
    border-top: 1px solid #e5e7eb;
}

.dropdown-footer a {
    color: #3b82f6;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.dropdown-footer a:hover {
    text-decoration: underline;
}

/* User Menu Dropdown */
.user-menu {
    min-width: 220px;
}

.user-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-menu .dropdown-item i {
    width: 20px;
    color: #6b7280;
}

.user-menu .dropdown-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 8px 0;
}

/* ========================================
   SEARCH RESULTS
   ======================================== */
.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.search-results.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background-color: #f9fafb;
}

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

.search-result-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.search-result-meta {
    font-size: 12px;
    color: #6b7280;
}

/* Table Sorting */
table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px;
}

table th.sortable:hover {
    color: #3b82f6;
}

table th.sortable::after {
    content: '\f0dc';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 8px;
    opacity: 0.3;
    font-size: 10px;
}

table th.sortable.asc::after {
    content: '\f0de';
    opacity: 1;
    color: #3b82f6;
}

table th.sortable.desc::after {
    content: '\f0dd';
    opacity: 1;
    color: #3b82f6;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    padding: 16px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: #FF9F1C;
    color: white;
    font-size: 16px !important;
    font-weight: 500;
}

.btn-primary:hover {
    background-color: #e88d0a;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn .icon-span,
.btn .text-span {
    display: flex;
    align-items: center;
}

/* Button styles for edit button in data tables */
.data-table .btn {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: #fff;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    background-color: #007bff;
    border: 1px solid #007bff;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.data-table .btn:hover {
    color: #fff;
    background-color: #0056b3;
    border-color: #004085;
}

.data-table .btn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.data-table .btn-primary:hover {
    color: #fff;
    background-color: #0056b3;
    border-color: #004085;
}

.data-table .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.2rem;
}

/* Button Containers */
.btn-container {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* ========================================
   LOADING STATE
   ======================================== */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* ========================================
   PANEL LATERAL (Crear/Editar)
   ======================================== */
.edit-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.edit-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 30%;
    height: 100vh;
    max-height: 100vh;
    background-color: #f5f7fa;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: none;
    display: flex;
    flex-direction: column;
}

.edit-panel.open {
    transform: translateX(0);
}

.edit-panel-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    background-color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.edit-panel-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: #111827;
}

.edit-panel-body {
    padding: 20px;
    padding-bottom: 100px; /* Espacio para los botones */
    flex: 1;
    overflow-y: auto;
    height: calc(100vh - 68.5px);
}

/* ========================================
   FORMULARIOS
   ======================================== */
.form-group {
    margin-bottom: 15px;
    flex: 1;
}

.form-section {
    margin-bottom: 30px;
}

.form-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e1e8ed;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 10px;
    padding: 24px 20px;
    border-top: 1px solid #e5e7eb;
    background-color: #F6F7FA;
    z-index: 0;
}

.form-actions .btn {
    flex: 1;
}

/* ========================================
   MENSAJES DE ERROR Y ÉXITO
   ======================================== */
.error-message {
    color: #e74c3c;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.success-message {
    color: #27ae60;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ========================================
   MESSAGES / CHAT STYLES
   ======================================== */
.chat-layout {
    display: flex;
    height: calc(100vh - 130px); /* Ajustar para que cubra el largo disponible */
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.chat-sidebar {
    width: 320px;
    background-color: #ffffff;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid #f1f3f4;
}

.chat-item:hover {
    background-color: #fceaea;
}

.chat-item.active {
    background-color: #fceaea;
    border-left: 4px solid #790016;
}

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #790016;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
    flex-shrink: 0;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-phone {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.chat-snippet {
    font-size: 14px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
}

.chat-header {
    padding: 20px 30px;
    background-color: #ffffff;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.contact-info {
    display: flex;
    flex-direction: column;
}

.contact-phone {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.chat-messages {
    flex: 1;
    padding: 20px 30px;
    overflow-y: auto;
    background-color: #f5f5f5;
}

.message {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-in;
}

.message.received {
    align-items: flex-start;
}

.message.sent {
    align-items: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 12px 18px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

.message.received .message-content {
    background-color: #ffffff;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message.sent .message-content {
    background-color: #8887e7;
    color: white;
    box-shadow: 0 2px 8px rgba(136, 135, 231, 0.3);
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 18px;
}

.chat-input {
    display: flex;
    padding: 20px 30px;
    background-color: #ffffff;
    border-top: 1px solid #e9ecef;
    align-items: center;
}

#messageInput {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #e1e5e9;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    background-color: #f8f9fa;
    transition: border-color 0.3s ease;
}

#messageInput:focus {
    border-color: #8887e7;
    background-color: #ffffff;
}

#sendButton {
    margin-left: 15px;
    width: 45px;
    height: 45px;
    background-color: #790016;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(121, 0, 22, 0.3);
}

#sendButton:hover {
    background-color: #b22222;
    transform: scale(1.05);
}

#sendButton i {
    font-size: 16px;
}

/* Chat actions menu */
.chat-actions {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: 10px;
}

.chat-actions-btn {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.chat-actions-btn:hover {
    background-color: #f0f0f0;
    color: #333;
}

.chat-actions-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    z-index: 1000;
    display: none;
    margin-top: 5px;
}

.chat-actions-menu.show {
    display: block;
}

.chat-actions-menu-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: #333;
    font-size: 14px;
}

.chat-actions-menu-item:hover {
    background-color: #f5f5f5;
}

.chat-actions-menu-item.delete {
    color: #dc3545;
}

.chat-actions-menu-item.delete:hover {
    background-color: #fee;
}

.chat-actions-menu-item i {
    margin-right: 10px;
    width: 16px;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        left: -260px;
        transition: left 0.3s ease;
    }

    .sidebar.active {
        left: 0;
    }

    .topbar {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .search-box input {
        width: 200px;
    }

    .user-info {
        display: none;
    }

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

    .table-container th,
    .table-container td {
        width: auto;
    }

    .edit-panel {
        width: 100%;
    }

    .switch-text {
        font-size: 10px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .btn-container {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    /* Chat responsive */
    .chat-layout {
        flex-direction: column;
        height: auto;
    }
    .chat-sidebar {
        width: 100%;
        height: 200px;
    }
    .chat-list {
        display: flex;
        overflow-x: auto;
        padding: 10px;
    }
    .chat-item {
        min-width: 200px;
        margin-right: 10px;
    }
}

/* Compactación para pantallas con altura limitada */
@media (max-height: 800px) {
    input,
    textarea,
    select {
        padding: 14px;
        font-size: 15px;
    }

    label {
        font-size: 14px;
    }

    .edit-panel-body {
        padding-bottom: 85px; /* Espacio para los botones */
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-section {
        margin-bottom: 20px;
    }

    .form-section-title {
        font-size: 16px;
        margin-bottom: 15px;
        padding-bottom: 8px;
    }

    .form-row {
        gap: 15px;
        margin-bottom: 12px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }

    .form-actions {
        margin-top: 16px;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: #f5f7fa;
        padding: 20px;
        border-top: 1px solid #e5e7eb;
        z-index: 0;
    }
}