/**
 * Custom CSS - SIM Ternak Lele
 * Additional styling for application
 */

/* ==================== GENERAL ==================== */
body {
    font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, sans-serif;
}

.pointer {
    cursor: pointer;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

/* ==================== CARDS ==================== */
.card-primary .card-header {
    background-color: #007bff;
    color: white;
}

.card-success .card-header {
    background-color: #28a745;
    color: white;
}

.card-info .card-header {
    background-color: #17a2b8;
    color: white;
}

.card-warning .card-header {
    background-color: #ffc107;
    color: #212529;
}

.card-danger .card-header {
    background-color: #dc3545;
    color: white;
}

.small-box {
    border-radius: 0.25rem;
    position: relative;
    display: block;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

.small-box > .inner {
    padding: 10px;
}

.small-box h3 {
    font-size: 38px;
    font-weight: bold;
    margin: 0 0 10px 0;
    white-space: nowrap;
    padding: 0;
}

.small-box p {
    font-size: 16px;
    margin-bottom: 0;
}

.small-box .icon {
    color: rgba(0, 0, 0, 0.15);
    z-index: 0;
}

.small-box .icon > i {
    font-size: 90px;
    position: absolute;
    right: 15px;
    top: 15px;
    transition: all 0.3s linear;
}

.small-box:hover .icon > i {
    font-size: 95px;
}

.small-box .small-box-footer {
    display: block;
    z-index: 10;
    background: rgba(0, 0, 0, 0.1);
    padding: 3px 0;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    text-decoration: none;
}

.small-box .small-box-footer:hover {
    color: #fff;
    background: rgba(0, 0, 0, 0.15);
}

/* ==================== BUTTONS ==================== */
.btn {
    border-radius: 0.25rem;
}

.btn-app {
    border-radius: 3px;
    position: relative;
    padding: 15px 5px;
    margin: 0 0 10px 10px;
    min-width: 80px;
    height: 60px;
    text-align: center;
    color: #666;
    border: 1px solid #ddd;
    background-color: #f4f4f4;
    font-size: 12px;
}

.btn-app > .fa,
.btn-app > .fas,
.btn-app > .far,
.btn-app > .fab,
.btn-app > .glyphicon,
.btn-app > .ion {
    font-size: 20px;
    display: block;
}

.btn-app:hover {
    background: #f4f4f4;
    color: #444;
    border-color: #aaa;
}

.btn-app:active,
.btn-app:focus {
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}

/* ==================== FORMS ==================== */
.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.input-group-text {
    background-color: #e9ecef;
    border: 1px solid #ced4da;
}

.custom-file-label::after {
    content: "Browse";
}

.image-preview {
    max-width: 200px;
    max-height: 200px;
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
}

/* ==================== TABLES ==================== */
.table-responsive {
    overflow-x: auto;
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table-actions {
    white-space: nowrap;
}

.table-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* ==================== BADGES ==================== */
.badge {
    font-weight: 600;
    padding: 0.35em 0.65em;
}

.badge-pill {
    border-radius: 10rem;
}

/* ==================== TIMELINE ==================== */
.timeline {
    position: relative;
    margin: 0 0 30px 0;
    padding: 0;
    list-style: none;
}

.timeline:before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #ddd;
    left: 31px;
    margin: 0;
    border-radius: 2px;
}

.timeline > li {
    position: relative;
    margin-right: 10px;
    margin-bottom: 15px;
}

.timeline > li > .timeline-item {
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    margin-top: 0;
    background: #fff;
    color: #444;
    margin-left: 60px;
    margin-right: 15px;
    padding: 0;
    position: relative;
}

.timeline > li > .timeline-item > .time {
    color: #999;
    float: right;
    padding: 10px;
    font-size: 12px;
}

.timeline > li > .timeline-item > .timeline-header {
    margin: 0;
    color: #555;
    border-bottom: 1px solid #f4f4f4;
    padding: 10px;
    font-size: 16px;
    line-height: 1.1;
}

.timeline > li > .timeline-item > .timeline-body,
.timeline > li > .timeline-item > .timeline-footer {
    padding: 10px;
}

.timeline > li > .fa,
.timeline > li > .fas,
.timeline > li > .far,
.timeline > li > .fab,
.timeline > li > .glyphicon,
.timeline > li > .ion {
    width: 30px;
    height: 30px;
    font-size: 15px;
    line-height: 30px;
    position: absolute;
    color: #666;
    background: #d2d6de;
    border-radius: 50%;
    text-align: center;
    left: 18px;
    top: 0;
}

/* ==================== INFO BOX ==================== */
.info-box {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    border-radius: 0.25rem;
    background: #fff;
    display: flex;
    margin-bottom: 1rem;
    min-height: 80px;
    padding: 0;
    position: relative;
}

.info-box .info-box-icon {
    border-radius: 0.25rem 0 0 0.25rem;
    align-items: center;
    display: flex;
    font-size: 45px;
    justify-content: center;
    text-align: center;
    width: 80px;
}

.info-box .info-box-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.8;
    flex: 1;
    padding: 0 10px;
}

.info-box .info-box-text,
.info-box .progress-description {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info-box .info-box-number {
    display: block;
    font-weight: bold;
    font-size: 18px;
}

.info-box .progress {
    background: rgba(0, 0, 0, 0.125);
    margin: 5px -10px 5px -10px;
    height: 2px;
}

.info-box .progress .progress-bar {
    background: #fff;
}

/* ==================== LOADING ==================== */
.overlay {
    z-index: 50;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 3px;
}

.overlay > .fa,
.overlay > .fas,
.overlay > .far,
.overlay > .fab,
.overlay > .fal,
.overlay > .fad,
.overlay > .glyphicon,
.overlay > .ion {
    position: absolute;
    top: 50%;
    left: 50%;
    margin-left: -15px;
    margin-top: -15px;
    color: #000;
    font-size: 30px;
}

/* ==================== DASHBOARD STATS ==================== */
.stat-card {
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .no-print,
    .main-sidebar,
    .main-header,
    .content-header,
    .btn,
    .pagination {
        display: none !important;
    }

    .content-wrapper {
        margin-left: 0 !important;
    }

    .card {
        border: 1px solid #ddd;
        box-shadow: none;
    }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 767.98px) {
    .small-box h3 {
        font-size: 28px;
    }

    .small-box .icon > i {
        font-size: 60px;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    .btn-app {
        min-width: 60px;
        margin: 0 5px 10px 5px;
    }
}

/* ==================== DARK MODE (OPTIONAL) ==================== */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles here if needed */
}

/* ==================== CUSTOM ANIMATIONS ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* ==================== STATUS INDICATORS ==================== */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.status-indicator.active {
    background-color: #28a745;
}

.status-indicator.inactive {
    background-color: #6c757d;
}

.status-indicator.pending {
    background-color: #ffc107;
}

.status-indicator.danger {
    background-color: #dc3545;
}

/* ==================== FILE UPLOAD PREVIEW ==================== */
.file-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.file-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.file-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview-item .remove-file {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #dc3545;
}

.file-preview-item .remove-file:hover {
    background: #dc3545;
    color: white;
}

/* ==================== SIDEBAR IMPROVEMENTS ==================== */
/* Tighter sidebar items with clearer icon alignment and nicer count badges */
.main-sidebar .nav-sidebar .nav-link {
    padding: 10px 12px;
    font-size: 0.95rem;
}

.main-sidebar .nav-sidebar .nav-link .nav-icon {
    width: 26px;
    text-align: center;
    margin-right: 8px;
    font-size: 18px;
    color: #cfe3f8;
}

.main-sidebar .nav-sidebar .nav-link p {
    margin: 0;
    display: inline-block;
}

/* small blue counts (like notification chips) on the right of menu items */
.sidebar .nav .nav-link .badge.menu-count {
    background-color: #00a6d6;
    color: #fff;
    font-size: 0.75rem;
    padding: 0.25rem 0.45rem;
    border-radius: 12px;
    margin-left: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* make treeview child links slightly indented and lighter */
.nav-treeview > .nav-item > .nav-link {
    padding-left: 28px;
    font-size: 0.92rem;
    color: #d8e7ff;
}

/* active/hover states */
.main-sidebar .nav-sidebar .nav-link.active {
    background-color: rgba(0, 150, 200, 0.12);
    color: #fff;
}

.main-sidebar .nav-sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* header separators */
.nav-header {
    color: #b8d7ff;
    font-size: 0.78rem;
    padding: 10px 12px;
}

/* reduce icon sizes for compact look */
.brand-image {
    width: 36px;
    height: 36px;
}

/* ensure user panel looks compact */
.user-panel .image img {
    width: 36px;
    height: 36px;
}

/* small-screen: keep sidebar usable */
@media (max-width: 768px) {
    .main-sidebar .nav-sidebar .nav-link p {
        font-size: 0.92rem;
    }
}

/* Hide numeric menu-count badges in sidebar (per request) */
.main-sidebar .nav-sidebar .nav-link .badge.menu-count {
    display: none !important;
}

/* Position chevron absolutely so it never overlaps the menu text */
.main-sidebar .nav-sidebar .nav-link {
    position: relative;
}

.main-sidebar .nav-sidebar .nav-link .right.fas.fa-angle-left,
.main-sidebar .nav-sidebar .nav-link .right.fas.fa-angle-down {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* Give the label more right padding so content doesn't collide with chevron */
.main-sidebar .nav-sidebar .nav-link p {
    display: block;
    padding-right: 72px; /* increased so wrapped lines don't go under chevron */
    white-space: normal; /* allow text to wrap instead of overflowing */
    line-height: 1.25;
}

/* Make the small circle icon on child items more muted */
.nav-treeview .nav-icon.far.fa-circle {
    font-size: 14px;
    color: #9fb8d9;
}
