/* Mobile-First CSS Framework for KUBER */

:root {
    --scio-orange: #FF6B35;
    --scio-orange-light: #FF9E7D;
    --scio-dark: #1e1e2d;
    --touch-target: 44px;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --card-radius: 12px;
}

body {
    touch-action: manipulation;
}


/* Base Responsive Container */
.container-fluid {
    padding-left: 15px;
    padding-right: 15px;
}

/* Touch-Friendly Elements - Scoped to avoid breaking dashboard icons */
.project-card .btn,
.subheader-block .btn {
    min-height: var(--touch-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
}

/* Mobile-only global touch targets */
@media (max-width: 991.98px) {

    .btn-primary,
    .btn-secondary,
    .btn-info,
    .btn-success,
    .btn-danger {
        min-height: var(--touch-target);
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Card Enhancements (Unified Design) */
.card {
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 20px;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.card-body {
    padding: 1.25rem;
}

/* Project Specific Cards */
.project-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--scio-dark);
}

.project-status {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    font-weight: 700;
}

/* Responsive Grid Improvements */
@media (max-width: 575.98px) {
    .subheader {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .subheader-block {
        margin-top: 15px;
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .subheader-block .btn {
        width: 100%;
        margin-right: 0 !important;
    }

    .card-body {
        padding: 1rem;
    }
}

/* Progress Bar enhancements */
.progress {
    height: 8px;
    border-radius: 10px;
    background-color: #f0f0f0;
}

.progress-bar {
    background-color: var(--scio-orange);
}

/* Avatar stacking for mobile */
.user-stacked img {
    width: 32px;
    height: 32px;
    border: 2px solid #fff;
    margin-left: -10px;
}

.user-stacked:first-child img {
    margin-left: 0;
}

/* Desktop Optimization for Unified Look */
/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.project-card {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Status Badge Polishing */
.bg-success-light {
    background-color: #e6fffa;
    color: #319795;
}

.bg-danger-light {
    background-color: #fff5f5;
    color: #e53e3e;
}

/* Truncate text utility */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.extra-small {
    font-size: 0.7rem;
}

/* Hero Section & Modern Dashboard Elements */
.hero-section {
    padding: 2rem 0;
    margin-bottom: 1.5rem;
}

.hero-section h1 {
    font-weight: 700 !important;
    font-size: 2.2rem !important;
    margin-bottom: 0.5rem;
    color: var(--text-main) !important;
}

.hero-section .description {
    color: var(--text-muted) !important;
    font-size: 1rem !important;
    max-width: 600px;
    opacity: 0.8 !important;
}

.modern-summary-card {
    background: var(--bg-panel) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-md) !important;
    padding: 1.25rem !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    transition: var(--transition-base) !important;
    height: 100%;
    box-shadow: var(--shadow-sm) !important;
}

.modern-summary-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.modern-summary-card .label {
    font-size: 0.8rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: var(--text-muted) !important;
    margin-bottom: 0.25rem !important;
    opacity: 0.8 !important;
}

.modern-summary-card .value {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main) !important;
}

.icon-circle-translucent {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    background: var(--bg-body) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--primary-color) !important;
    border: 1px solid var(--border-color) !important;
    overflow: hidden;
}

.icon-circle-translucent svg,
.icon-circle-translucent i {
    width: 24px !important;
    height: 24px !important;
}

.text-green-500 {
    color: #10b981 !important;
}

/* Quick Actions Bar */
.quick-actions-bar {
    display: flex !important;
    gap: 0.75rem !important;
    flex-wrap: wrap !important;
    margin-bottom: 2rem !important;
}

.btn-ghost {
    background: var(--bg-btn-default) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    padding: 10px 18px !important;
    border-radius: var(--border-radius-sm) !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    transition: var(--transition-fast) !important;
    font-weight: 500 !important;
    font-size: 0.95rem !important;
    min-height: 44px;
}

.btn-ghost svg {
    color: var(--primary-color) !important;
}

.btn-ghost:hover {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
    text-decoration: none !important;
    transform: translateY(-2px);
}

.btn-ghost:hover svg {
    color: #fff !important;
}

@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2rem;
    }

    .quick-actions-bar {
        justify-content: center;
    }

    .btn-ghost {
        flex: 1 1 calc(50% - 1rem);
        justify-content: center;
    }
}

/* Universal Back Button Styling */
.btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: var(--primary-color);
    margin-right: 5px;
    border-radius: 50%;
    transition: background 0.2s ease, transform 0.1s ease;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.btn-back:hover {
    background: rgba(0, 0, 0, 0.05);
}

.btn-back:active {
    transform: scale(0.92);
    background: rgba(0, 0, 0, 0.1);
}

.btn-back svg {
    width: 28px;
    height: 28px;
}

/* Dark mode adjustment for back button hover */
[data-theme='dark'] .btn-back:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme='dark'] .btn-back:active {
    background: rgba(255, 255, 255, 0.1);
}

@media (min-width: 992px) {
    .btn-back {
        margin-right: 15px;
    }
}

/* Dashboard Table-to-Card Transformation */
.dashboard-card {
    background: var(--panel-bg, #fff);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}

[data-theme='dark'] .dashboard-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.dashboard-card:active {
    transform: scale(0.98);
}

/* HR / Employees Modernization */

.hr-filter-bar {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.hr-search-input {
    background: var(--bg-body) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    border-radius: var(--border-radius-sm) !important;
    padding: 0.6rem 1rem !important;
    width: 100%;
}

.hr-filter-select {
    min-width: 150px;
    background: var(--bg-body) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    border-radius: var(--border-radius-sm) !important;
    padding: 0.6rem !important;
    cursor: pointer;
}

.hr-view-toggles {
    display: flex;
    gap: 2px;
    background: var(--border-color);
    padding: 2px;
    border-radius: var(--border-radius-sm);
}

.hr-view-btn {
    padding: 8px 12px;
    border: none;
    background: var(--bg-body);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.hr-view-btn.active {
    background: var(--primary-color);
    color: #fff;
}

.hr-view-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.hr-view-btn:last-child {
    border-radius: 0 4px 4px 0;
}

/* Grid View Cards (Cleaner Interface) */
.employee-modern-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
    position: relative;
    overflow: hidden;
    height: calc(100% - 1.5rem);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
}

.employee-modern-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.employee-avatar-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
}

.employee-avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--bg-body);
    box-shadow: var(--shadow-sm);
}

.status-indicator {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid var(--bg-panel);
}

.status-online {
    background-color: #10b981;
}

.status-offline {
    background-color: #94a3b8;
}

.employee-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.employee-role {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 500;
}

.employee-dept-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* List View Styles */
.employee-list-view {
    display: none;
    /* Controlled by JS */
    background: var(--bg-panel);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.hr-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.hr-table th {
    background: var(--bg-body);
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.hr-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.hr-table tr:last-child td {
    border-bottom: none;
}

.hr-table .emp-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hr-table .emp-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.hr-table .emp-details .name {
    font-weight: 600;
    color: var(--text-main);
    display: block;
}

.hr-table .emp-details .email {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* responsive table for mobile */
@media (max-width: 768px) {
    .hr-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .hr-search-input {
        min-width: 100%;
    }

    .hr-table thead {
        display: none;
    }

    .hr-table tr {
        display: block;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }

    .hr-table td {
        display: block;
        padding: 0.5rem 0;
        border: none;
        text-align: right;
        position: relative;
    }

    .hr-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.8rem;
    }

    .hr-table td.emp-cell {
        text-align: left;
    }

    .hr-table td.emp-cell::before {
        display: none;
    }
}

/* Visibility Control */
.view-mode-grid .employee-grid-view {
    display: flex;
}

.view-mode-grid .employee-list-view {
    display: none;
}

.view-mode-list .employee-grid-view {
    display: none;
}

.view-mode-list .employee-list-view {
    display: block;
}

/* Attendance Management Modernization */

.attendance-stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    height: 100%;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

.attendance-stat-card:hover {
    transform: translateY(-3px);
}

.attendance-stat-card .icon-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.attendance-stat-card .stat-details .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.attendance-stat-card .stat-details .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

/* Status Badges */
.badge-attendance {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-attendance::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-presente {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.badge-presente::before {
    background: #10b981;
}

.badge-tardanza {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.badge-tardanza::before {
    background: #ef4444;
}

.badge-descanso {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.badge-descanso::before {
    background: #f59e0b;
}

.badge-completado {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.badge-completado::before {
    background: #6366f1;
}

.badge-ausente {
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
}

.badge-ausente::before {
    background: #94a3b8;
}

/* Time Indicators */
.time-box {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 8px 12px;
    text-align: center;
    min-width: 80px;
}

.time-box .label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    display: block;
    margin-bottom: 2px;
}

.time-box .time {
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.9rem;
}

/* Action Buttons */
.btn-attendance {
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.btn-entrada {
    background: var(--primary-color);
    color: #fff;
}

.btn-entrada:hover {
    background: var(--primary-color-dark);
    transform: scale(1.02);
}

.btn-salida {
    background: #f43f5e;
    color: #fff;
}

.btn-salida:hover {
    background: #e11d48;
    transform: scale(1.02);
}

.btn-reanudar {
    background: #f59e0b;
    color: #fff;
}

.btn-reanudar:hover {
    background: #d97706;
    transform: scale(1.02);
}

.biometric-link {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: color 0.2s;
}

.biometric-link:hover {
    color: var(--primary-color);
}

/* Note Field */
.attendance-note-input {
    background: var(--bg-body) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-sm) !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.85rem !important;
    color: var(--text-main) !important;
    min-width: 200px;
}

/* Table Enhancements */
.attendance-table th {
    background: var(--bg-body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 1.25rem 1rem;
}

.attendance-table td {
    padding: 1rem;
    vertical-align: middle;
}

.attendance-row-connector {
    width: 20px;
    height: 1px;
    background: var(--border-color);
    display: inline-block;
    margin: 0 5px;
}

/* Map & Geolocation Styles */
#attendanceMap {
    border-radius: 0 0 var(--border-radius-md) var(--border-radius-md);
    z-index: 1;
}

.bg-primary-10 {
    background-color: rgba(var(--primary-color-rgb), 0.1);
}

.badge-geo {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 4px;
}

.leaflet-popup-content-wrapper {
    background: var(--bg-panel) !important;
    color: var(--text-main) !important;
    border-radius: var(--border-radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-tip {
    background: var(--bg-panel) !important;
}