/* Dashboard-specific styles */

:root {
    --primary-color: #4e73df;
    --secondary-color: #36b9cc;
    --success-color: #1cc88a;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --dark-color: #2c3e50;
    --light-color: #f8f9fc;
    --sidebar-bg: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Override sidebar and top-bar colors to match other pages */
.sidebar {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%) !important;
}

.top-bar {
    background: linear-gradient(90deg, #4e73df 0%, #224abe 100%) !important;
    color: white !important;
}

.top-bar .datetime, .top-bar .date {
    color: white !important;
}

/* Version info in top bar */
.version-info {
    font-size: 12px;
    color: #7f8c8d;
    margin-left: 10px;
}

.date-info {
    font-size: 12px;
    color: #7f8c8d;
    margin-left: 5px;
}

/* Stats Grid - Updated to match customers.php */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
    width: 100%;
    box-sizing: border-box;
}

.stats-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.stats-card.stats-primary::before {
    background: linear-gradient(90deg, #4e73df 0%, #224abe 100%);
}

.stats-card.stats-warning::before {
    background: linear-gradient(90deg, #f6c23e 0%, #e0a800 100%);
}

.stats-card.stats-success::before {
    background: linear-gradient(90deg, #1cc88a 0%, #13855c 100%);
}

.stats-card.stats-danger::before {
    background: linear-gradient(90deg, #e74a3b 0%, #c0392b 100%);
}

.stats-card.stats-info::before {
    background: linear-gradient(90deg, #36b9cc 0%, #2c9faf 100%);
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4e73df 0%, #224abe 100%);
}

.stats-card .stats-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    position: relative;
    z-index: 1;
}

.stats-card.stats-primary .stats-icon {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
}

.stats-card.stats-warning .stats-icon {
    background: linear-gradient(135deg, #f6c23e 0%, #e0a800 100%);
}

.stats-card.stats-success .stats-icon {
    background: linear-gradient(135deg, #1cc88a 0%, #13855c 100%);
}

.stats-card.stats-danger .stats-icon {
    background: linear-gradient(135deg, #e74a3b 0%, #c0392b 100%);
}

.stats-card.stats-info .stats-icon {
    background: linear-gradient(135deg, #36b9cc 0%, #2c9faf 100%);
}

.stats-content {
    flex: 1;
}

.stats-number {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
    display: block;
    line-height: 1;
}

.stats-label {
    font-size: 14px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Schedule Summary - Updated to match customers.php */
.schedule-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
}

.schedule-item {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid #f0f2f5;
    position: relative;
    overflow: hidden;
}

.schedule-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4e73df 0%, #224abe 100%);
}

.schedule-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.schedule-count {
    font-size: 36px;
    font-weight: 700;
    color: #4e73df;
    margin-bottom: 8px;
    line-height: 1;
}

.schedule-count.text-primary {
    color: #4e73df;
}

.schedule-count.text-info {
    color: #36b9cc;
}

.schedule-count.text-danger {
    color: #e74a3b;
}

.schedule-label {
    font-size: 13px;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Card styling - Updated to match customers.php */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    overflow: hidden;
    border: none;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.card-header {
    padding: 25px;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 12px;
}

@media (max-width: 768px) {
  .card-header {
    flex-wrap: wrap;
    gap: 10px;
  }
  .card-title {
    width: 100%;
    margin-bottom: 8px;
  }
  .card-header .btn {
    align-self: flex-start;
    margin-left: auto;
  }
}

.card-body {
    padding: 25px;
}

/* Table styling - Updated to match customers.php */
.table-container {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    background: white;
    border: 1px solid #f0f2f5;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    margin: 0;
}

.table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #2c3e50;
    border-bottom: 2px solid #f0f2f5;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.table td {
    padding: 15px;
    border-bottom: 1px solid #f0f2f5;
    font-size: 14px;
    color: #495057;
    vertical-align: middle;
    transition: all 0.3s ease;
}

.table tbody tr {
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* Status text for overdue dates */
.text-overdue {
    color: #e74a3b;
    font-weight: 600;
}

/* Button styling - Updated to match customers.php */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn::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:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    color: white;
    box-shadow: 0 5px 20px rgba(78, 115, 223, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2e59d9 0%, #1e3d8f 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(78, 115, 223, 0.4);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-outline-primary {
    background: transparent;
    color: #4e73df;
    border: 2px solid #4e73df;
    box-shadow: 0 2px 10px rgba(78, 115, 223, 0.1);
}

.btn-outline-primary:hover {
    background: #4e73df;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(78, 115, 223, 0.3);
}

/* User avatar styling */
.user-avatar-sidebar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #4e73df 0%, #36b9cc 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Alert styling - Updated to match customers.php */
.alert {
    padding: 20px 25px;
    border-radius: 16px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.alert:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
}

/* Text utilities - Updated to match customers.php */
.text-muted {
    color: #6c757d;
    font-weight: 500;
}

.text-primary {
    color: #4e73df;
}

.text-info {
    color: #36b9cc;
}

.text-danger {
    color: #e74a3b;
}

.fw-bold {
    font-weight: 700;
}

/* Activity list styling - Enhanced */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 16px;
    border: 1px solid #f0f2f5;
    transition: all 0.3s ease;
}

.activity-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border-color: #e1e8ed;
}

.activity-avatar {
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-time {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 5px;
}

.activity-text {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
}

.activity-desc {
    font-size: 13px;
    color: #6c757d;
    margin-top: 5px;
    font-style: italic;
}

/* Flex utilities */
.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 10px;
}

.me-2 {
    margin-right: 10px;
}

.mb-3 {
    margin-bottom: 15px;
}

.py-5 {
    padding-top: 40px;
    padding-bottom: 40px;
}

.text-center {
    text-align: center;
}

/* Badge styling - Enhanced */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-menunggu {
    background: linear-gradient(135deg, #f6c23e 0%, #e0a800 100%);
    color: white;
}

.badge-selesai_dipasang {
    background: linear-gradient(135deg, #1cc88a 0%, #13855c 100%);
    color: white;
}

.badge-proses {
    background: linear-gradient(135deg, #36b9cc 0%, #2c9faf 100%);
    color: white;
}

/* Empty state styling - Enhanced */
.text-center.py-5 {
    padding: 60px 20px !important;
}

.text-center.py-5 i {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-center.py-5 h4 {
    font-weight: 700;
    color: #495057;
    margin-bottom: 10px;
}

.text-center.py-5 p {
    font-size: 14px;
    color: #6c757d;
    max-width: 400px;
    margin: 0 auto;
}

/* Animation keyframes for enhanced visual effects */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Apply animations to elements - Fixed to prevent disappearing */
.stats-card {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 1;
    visibility: visible;
}

.stats-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stats-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stats-card:nth-child(3) {
    animation-delay: 0.3s;
}

.stats-card:nth-child(4) {
    animation-delay: 0.4s;
}

/* Ensure stats cards are always visible */
.stats-card,
.stats-card * {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Override AOS to prevent hiding elements */
.stats-card[data-aos] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}

.stats-card[data-aos].aos-animate {
    opacity: 1 !important;
    transform: none !important;
}

.schedule-item {
    animation: fadeInUp 0.5s ease-out;
}

.card {
    animation: fadeInUp 0.7s ease-out;
}

.stats-icon {
    animation: pulse 2s infinite;
}

.stats-card:hover .stats-icon {
    animation: pulse 0.5s ease-in-out;
}

/* Shimmer effect for gradient backgrounds */
.stats-card::before,
.btn-primary,
.badge-menunggu,
.badge-selesai_dipasang,
.badge-proses {
    background-size: 200% 100%;
    background-position: 0 0;
    transition: background-position 0.5s ease;
}

.stats-card:hover::before,
.btn-primary:hover,
.badge-menunggu:hover,
.badge-selesai_dipasang:hover,
.badge-proses:hover {
    background-position: 100% 0;
}

/* Content area styling */
.content-area {
    padding: 30px;
}

/* Dashboard layout */
.dashboard {
    display: flex;
    min-height: 100vh;
    position: relative;
}

.menu-toggle {
    display: none;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-normal);
    min-height: 100vh;
    background-color: #f5f7fa;
}

/* Responsive adjustments - Enhanced */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .schedule-summary {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .card-header {
        padding: 25px;
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    /* Show menu toggle on mobile */
    .menu-toggle {
        display: flex !important;
    }
    
    .card-title {
        font-size: 18px;
    }
    
    .table th,
    .table td {
        padding: 12px 10px;
        font-size: 12px;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
    }
    
    .table {
        min-width: 600px;
    }
    
    .stats-card {
        padding: 25px;
        gap: 20px;
    }
    
    .stats-icon {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }
    
    .stats-number {
        font-size: 28px;
    }
    
    .stats-label {
        font-size: 12px;
    }
    
    .activity-item {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .main-content {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .content-area {
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .stats-grid {
        gap: 15px;
        margin-bottom: 20px;
        grid-template-columns: 1fr;
        width: 100%;
        box-sizing: border-box;
    }
    
    .stats-card {
        flex-direction: row;
        text-align: left;
        gap: 12px;
        padding: 15px;
        border-radius: 12px;
        background: white;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
        border-left: 4px solid;
        position: relative;
        overflow: visible;
        margin-bottom: 10px;
    }
    
    .stats-card::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 4px;
        height: 100%;
        border-radius: 4px 0 0 4px;
    }
    
    .stats-card.stats-primary::after {
        background: linear-gradient(180deg, #4e73df 0%, #224abe 100%);
    }
    
    .stats-card.stats-warning::after {
        background: linear-gradient(180deg, #f6c23e 0%, #e0a800 100%);
    }
    
    .stats-card.stats-success::after {
        background: linear-gradient(180deg, #1cc88a 0%, #13855c 100%);
    }
    
    .stats-card.stats-danger::after {
        background: linear-gradient(180deg, #e74a3b 0%, #c0392b 100%);
    }
    
    .stats-card.stats-info::after {
        background: linear-gradient(180deg, #36b9cc 0%, #2c9faf 100%);
    }
    
    .stats-card.stats-primary {
        border-left-color: #4e73df;
    }
    
    .stats-card.stats-warning {
        border-left-color: #f6c23e;
    }
    
    .stats-card.stats-success {
        border-left-color: #1cc88a;
    }
    
    .stats-card.stats-danger {
        border-left-color: #e74a3b;
    }
    
    .stats-card.stats-info {
        border-left-color: #36b9cc;
    }
    
    /* Stats icon colors matching customers.php */
    .stats-card.stats-primary .stats-icon {
        background: linear-gradient(135deg, #4e73df 0%, #224abe 100%) !important;
    }
    
    .stats-card.stats-warning .stats-icon {
        background: linear-gradient(135deg, #f6c23e 0%, #e0a800 100%) !important;
    }
    
    .stats-card.stats-success .stats-icon {
        background: linear-gradient(135deg, #1cc88a 0%, #13855c 100%) !important;
    }
    
    .stats-card.stats-danger .stats-icon {
        background: linear-gradient(135deg, #e74a3b 0%, #c0392b 100%) !important;
    }
    
    .stats-card.stats-info .stats-icon {
        background: linear-gradient(135deg, #36b9cc 0%, #2c9faf 100%) !important;
    }
    
    .stats-card::before {
        display: none;
    }
    
    .stats-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
        border-radius: 10px;
        flex-shrink: 0;
        box-shadow: none;
    }
    
    .stats-content {
        flex: 1;
    }
    
    .stats-number {
        font-size: 24px;
        font-weight: 800;
        color: #2c3e50;
        margin-bottom: 2px;
        line-height: 1;
    }
    
    .stats-label {
        font-size: 11px;
        color: #6c757d;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* Mobile header styling - Match image 2 - Simplified and consistent */
    .top-bar {
        background: linear-gradient(90deg, #4e73df 0%, #224abe 100%) !important;
        color: white !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        padding: 12px 15px;
        border-radius: 0 0 12px 12px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .top-bar-left {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .top-bar-left h2 {
        font-size: 16px;
        font-weight: 700;
        color: white;
        margin: 0;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    
    .top-bar-left h2 i {
        color: white;
        font-size: 16px;
    }
    
    .top-bar-right {
        flex-direction: column;
        align-items: flex-end;
        gap: 2px;
    }
    
    .datetime, .date {
        color: white;
        font-size: 11px;
        font-weight: 500;
        display: flex;
        align-items: center;
        gap: 3px;
    }
    
    .datetime i, .date i {
        color: white;
        font-size: 11px;
    }
    
    /* Menu toggle styling for mobile */
    .menu-toggle {
        background: none;
        border: none;
        font-size: 18px;
        cursor: pointer;
        color: white;
        padding: 5px;
        margin-right: 8px;
    }
    
    /* Ensure cards fill available width */
    .stats-card {
        width: 100%;
        box-sizing: border-box;
    }
    
    .schedule-item {
        padding: 15px;
        margin-bottom: 10px;
    }
    
    .schedule-count {
        font-size: 24px;
        font-weight: 800;
    }
    
    .schedule-label {
        font-size: 12px;
        font-weight: 600;
    }
    
    .card-header {
        padding: 15px;
        background: white;
        border-bottom: 1px solid #e9ecef;
    }
    
    .card-title {
        font-size: 16px;
    }
    
    .text-center.py-5 {
        padding: 30px 15px !important;
    }
    
    .text-center.py-5 i {
        font-size: 2rem;
    }
    
    /* Alert styling for mobile */
    .alert {
        padding: 15px;
        margin-bottom: 20px;
        font-size: 13px;
    }
    
    /* Remove the old top border effect on mobile */
    .stats-card .stats-icon {
        box-shadow: none;
    }
}

@media (min-width: 1025px) {
    /* Hide menu toggle on desktop */
    .menu-toggle {
        display: none !important;
    }
}

/* Sidebar open class for body */
body.sidebar-open {
    overflow: hidden;
}
