/* ============================================
   MundoLaser Dashboard - Main Stylesheet
   ============================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed: 0px;
    --primary: #4e73df;
    --primary-dark: #3a56b0;
    --secondary: #858796;
    --success: #1cc88a;
    --info: #36b9cc;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --dark: #2c3e50;
    --sidebar-bg: #1a1c2e;
    --sidebar-hover: #2d2f45;
    --sidebar-active: #ef7b05;
    --body-bg: #f0f2f5;
    --card-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--body-bg);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   Login Page
   ============================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1c2e 0%, #4e73df 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 36px;
    color: white;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.login-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
     background: linear-gradient(179deg, #23507b9e 0% 0%, #000000 100%);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
}

.sidebar-logo i {
    font-size: 1.5rem;
    margin-right: 10px;
    color: var(--primary);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

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

.user-avatar {
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

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

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

.sidebar-nav {
    list-style: none;
    padding: 15px 0;
    flex: 1;
}

.sidebar-nav .nav-item {
    margin: 2px 10px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: white;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: white;
    font-weight: 600;
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
    margin-right: 12px;
    font-size: 0.95rem;
}

.nav-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 10px 15px;
}

.nav-heading {
    padding: 5px 15px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
    font-weight: 600;
}

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

/* ============================================
   Main Content
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.top-navbar {
    background: white;
    padding: 12px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--card-shadow);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.page-title {
    font-weight: 600;
    color: var(--dark);
}

.user-dropdown {
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
}

.content-wrapper {
    padding: 25px;
    flex: 1;
}

.main-footer {
    background: white;
    padding: 15px 25px;
    font-size: 0.85rem;
    color: var(--secondary);
    border-top: 1px solid #e3e6f0;
}

/* ============================================
   Stat Cards
   ============================================ */
.stat-card {
    border-radius: 12px;
    padding: 20px;
    color: white;
    position: relative;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.stat-icon {
    font-size: 1.8rem;
    margin-bottom: 5px;
    opacity: 0.8;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.8rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bg-gradient-primary { background: linear-gradient(135deg, #4e73df, #224abe); }
.bg-gradient-success { background: linear-gradient(135deg, #1cc88a, #13855c); }
.bg-gradient-info { background: linear-gradient(135deg, #36b9cc, #258391); }
.bg-gradient-warning { background: linear-gradient(135deg, #f6c23e, #dda20a); }
.bg-gradient-danger { background: linear-gradient(135deg, #e74a3b, #be2617); }
.bg-gradient-secondary { background: linear-gradient(135deg, #858796, #60616f); }

/* ============================================
   Cards
   ============================================ */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.card-header {
    background: white;
    border-bottom: 1px solid #e3e6f0;
    padding: 15px 20px;
    font-weight: 600;
    border-radius: 12px 12px 0 0 !important;
}

.card-body {
    padding: 20px;
}

/* ============================================
   Quick Actions
   ============================================ */
.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--body-bg);
    border-radius: 12px;
    text-decoration: none;
    color: var(--dark);
    transition: all 0.3s;
    gap: 10px;
    min-height: 100px;
}

.quick-action-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow);
    color: var(--primary);
}

.quick-action-btn i {
    font-size: 1.8rem;
}

.quick-action-btn span {
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
}

/* ============================================
   Tables
   ============================================ */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--secondary);
    border-top: none;
}

.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* ============================================
   Forms
   ============================================ */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #495057;
}

/* ============================================
   Invoice / Sheet Style
   ============================================ */
.sheet-header {
    background: linear-gradient(135deg, var(--sidebar-bg), var(--primary));
    color: white;
    padding: 25px;
    border-radius: 12px 12px 0 0;
}

.sheet-header h4 {
    font-weight: 700;
    margin-bottom: 5px;
}

.sheet-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    font-size: 0.9rem;
}

.sheet-info-item {
    display: flex;
    flex-direction: column;
}

.sheet-info-item .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.7;
}

.sheet-info-item .value {
    font-weight: 600;
}

.sheet-body {
    background: white;
    padding: 20px;
    border: 1px solid #e3e6f0;
    border-top: none;
}

.sheet-footer {
    background: #f8f9fc;
    padding: 15px 25px;
    border: 1px solid #e3e6f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: flex-end;
}

.sheet-total {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

/* ============================================
   Action Buttons
   ============================================ */
.btn-action {
    padding: 4px 8px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.actions-cell {
    white-space: nowrap;
}

/* ============================================
   Permission Checkboxes
   ============================================ */
.perm-table th,
.perm-table td {
    text-align: center;
    vertical-align: middle;
}

.perm-table td:first-child,
.perm-table th:first-child {
    text-align: left;
}

/* ============================================
   Photo Preview
   ============================================ */
.photo-preview {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.photo-preview:hover {
    transform: scale(1.1);
}

.photo-preview-lg {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
}

/* ============================================
   File Cards
   ============================================ */
.file-card {
    border: 1px solid #e3e6f0;
    border-radius: 12px;
    padding: 15px;
    transition: all 0.3s;
    height: 100%;
    background: white;
}

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

.file-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.file-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 5px;
    word-break: break-word;
}

.file-meta {
    font-size: 0.8rem;
    color: var(--secondary);
}

/* ============================================
   Charts
   ============================================ */
.chart-container {
    position: relative;
    height: 300px;
}

/* ============================================
   Badges
   ============================================ */
.badge {
    font-weight: 500;
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

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

    .content-wrapper {
        padding: 15px;
    }

    .stat-card {
        min-height: 90px;
        padding: 15px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .stat-icon {
        font-size: 1.3rem;
    }

    .sheet-info {
        grid-template-columns: 1fr 1fr;
    }

    .top-navbar {
        padding: 10px 15px;
    }

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

    .quick-action-btn {
        padding: 15px 10px;
        min-height: 80px;
    }

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

    .login-card {
        padding: 25px;
    }
}

@media (max-width: 576px) {
    .sheet-info {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Overlay for mobile sidebar
   ============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1030;
}

.sidebar-overlay.show {
    display: block;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .sidebar,
    .top-navbar,
    .main-footer,
    .btn,
    .no-print {
        display: none !important;
    }

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

    .content-wrapper {
        padding: 0 !important;
    }
}

/* ============================================
   Animations
   ============================================ */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* ============================================
   DataTables override
   ============================================ */
.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
    border: 1px solid #d1d3e2;
    padding: 5px 12px;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 8px;
    border: 1px solid #d1d3e2;
}

/* ============================================
   Custom Scrollbar
   ============================================ */
.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* ============================================
   Loading Spinner
   ============================================ */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
