/* ====== NAVBAR HEADER ELEMENTS ====== */
.header-logo-inject {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid rgba(102, 126, 234, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.header-logo-inject:hover {
    transform: scale(1.1) rotate(5deg);
}

body.dark-mode .header-logo-inject {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
    background: #ffffff;
    padding: 2px; /* Add slight padding so logo doesn't touch edges if it's a circle */
}

.header-title-inject {
    font-size: 1rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.2;
    margin-bottom: 2px;
}

.header-subtitle-inject {
    font-size: 0.75rem;
    color: #7f8c8d;
    font-weight: 400;
    line-height: 1;
}

body.dark-mode .header-title-inject {
    color: #ecf0f1;
}

body.dark-mode .header-subtitle-inject {
    color: #bdc3c7;
}

.header-text-container {
    display: block;
    transition: all 0.3s ease;
    min-width: 0;
}

.header-datetime-inject {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.25);
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .header-datetime-inject {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ecf0f1;
}

body.dark-mode .datetime-divider {
    background: rgba(255, 255, 255, 0.1);
}

.datetime-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.datetime-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    white-space: nowrap;
}

.datetime-item i {
    font-size: 0.9rem;
    opacity: 0.9;
}

.date-item span {
    font-size: 0.85rem;
}

.time-item span {
    font-size: 0.95rem;
    font-family: "Courier New", Courier, monospace;
    letter-spacing: 0.5px;
}

.datetime-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
}

/* Mobile Responsive for Header */
@media (max-width: 991px) {
    .datetime-box {
        flex-direction: column;
        gap: 2px;
        align-items: flex-start;
    }

    .datetime-divider {
        display: none;
    }

    .header-datetime-inject {
        padding: 0.3rem 0.6rem;
        min-width: auto;
    }

    .date-item span,
    .time-item span {
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    .header-logo-inject {
        width: 38px;
        height: 38px;
    }

    .header-text-container {
        display: block; /* Keep text on tablets */
    }

    .header-title-inject {
        font-size: 0.8rem;
    }

    .header-subtitle-inject {
        font-size: 0.6rem;
    }
}

@media (max-width: 576px) {
    .header-logo-inject {
        width: 35px;
        height: 35px;
    }

    .header-text-container {
        display: none; /* Hide text only on mobile portrait */
    }

    .header-datetime-inject {
        display: flex; /* Keep clock but smaller */
        padding: 0.2rem 0.5rem;
    }

    .date-item span,
    .time-item span {
        font-size: 0.65rem;
    }

    .datetime-box {
        gap: 5px;
    }
}

.machine-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
    position: relative;
    background: #fff; /* Fallback */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Status Colors - Solid Colors as requested */
.machine-card.aktif {
    background: linear-gradient(135deg, #00a65a, #008d4c) !important;
}

.machine-card.maintenance {
    background: linear-gradient(135deg, #f1c40f, #f39c12) !important;
}

.machine-card.tidak-aktif {
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
}

.machine-card.setup {
    background: linear-gradient(135deg, #3498db, #2980b9) !important;
}

.machine-card.setdown {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d) !important;
}

/* Hover Effects - Subtle lift */
.machine-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
    z-index: 5;
}

/* ====== CARD HEADER ====== */
.machine-card .card-header {
    background: transparent !important; /* No overlay */
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.1rem 0.25rem;
}

.machine-name {
    font-size: 0.58rem;
    font-weight: 700;
    line-height: 1;
}

.machine-details {
    font-size: 0.48rem;
    opacity: 0.9;
    font-weight: 400;
}

/* ====== BADGE STYLING ====== */
.status-badge {
    padding: 0.08em 0.25em;
    font-size: 0.42rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-radius: 3px;
    background: rgb(255, 255, 255);
    color: #fff;
    border: 1px solid rgb(255, 255, 255);
}

/* ====== CARD BODY ====== */
.machine-card .card-body {
    padding: 0.2rem;
    background: transparent !important; /* No overlay */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Part Info Section */
.part-info-container {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 0.1rem 0.2rem;
    margin-bottom: 0.15rem;
    display: flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.part-icon {
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.2rem;
    font-size: 0.55rem;
    color: #fff;
}

.part-label {
    font-size: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0;
    line-height: 1;
}

.part-name {
    font-size: 0.52rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
}

/* Stats Grid */
.stat-box {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 0.08rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-label {
    font-size: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: rgba(255, 255, 255, 0.9);
    display: block;
    margin-bottom: 0;
}

.stat-value {
    font-size: 0.62rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.stat-unit {
    display: none;
}

/* Progress Section */
.progress-container {
    margin-top: 0.2rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 0.1rem;
}

.progress-label {
    font-size: 0.42rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.progress-percentage {
    font-size: 0.52rem;
    font-weight: 700;
    color: #fff;
}

.custom-progress {
    height: 3px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.custom-progress-bar {
    height: 100%;
    border-radius: 4px;
    background: #fff;
    transition: width 0.5s ease;
}

/* Dynamic Progress Colors */
.custom-progress-bar.bg-success {
    background: #fff;
}
.custom-progress-bar.bg-warning {
    background: #fff;
}
.custom-progress-bar.bg-danger {
    background: #fff;
}

/* ====== CARD FOOTER ====== */
.machine-card .card-footer {
    background: transparent !important; /* No overlay */
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.08rem;
    text-align: center;
    font-size: 0.48rem;
    color: rgba(255, 255, 255, 0.8);
    transition: background 0.2s;
}

.machine-card:hover .card-footer {
    background: rgba(0, 0, 0, 0.1);
    color: #fff;
}

/* ====== EMPTY STATE ====== */
.empty-state-icon {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.35rem;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ====== PROGRESS PERCENTAGE TOP ====== */
.progress-percentage-top {
    font-size: 0.85rem !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
    margin-bottom: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

body.dark-mode .progress-percentage-top {
    background: rgba(255, 255, 255, 0.1);
}

.machine-name-simple {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ====== CAMERA UI ENHANCED ====== */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-height: 300px;
    max-height: 500px;
    margin: 0 auto;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 2px solid #333;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Mobile optimization for camera */
@media (max-width: 576px) {
    .camera-container {
        min-height: 250px;
        max-height: 400px;
        border-radius: 12px;
    }
}

@media (min-width: 577px) and (max-width: 991px) {
    .camera-container {
        min-height: 350px;
        max-height: 450px;
    }
}

.camera-preview {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror effect */
    display: block;
}

.camera-preview-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}

.camera-preview-container img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Viewfinder Overlay */
.camera-container::before {
    content: "";
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    pointer-events: none;
    z-index: 5;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

/* Corner Brackets */
.camera-container::after {
    content: "";
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    pointer-events: none;
    z-index: 6;
    background:
        linear-gradient(to right, #3498db 4px, transparent 4px) 0 0,
        linear-gradient(to bottom, #3498db 4px, transparent 4px) 0 0,
        linear-gradient(to left, #3498db 4px, transparent 4px) 100% 0,
        linear-gradient(to bottom, #3498db 4px, transparent 4px) 100% 0,
        linear-gradient(to right, #3498db 4px, transparent 4px) 0 100%,
        linear-gradient(to top, #3498db 4px, transparent 4px) 0 100%,
        linear-gradient(to left, #3498db 4px, transparent 4px) 100% 100%,
        linear-gradient(to top, #3498db 4px, transparent 4px) 100% 100%;
    background-repeat: no-repeat;
    background-size: 30px 30px;
}

.camera-controls {
    position: absolute;
    bottom: 15px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through container */
}

.camera-controls button {
    pointer-events: auto; /* Re-enable clicks for buttons */
}

/* Capture Button */
.capture-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #2ecc71;
    border: 4px solid #fff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.4);
    position: relative;
}

.capture-btn::after {
    content: "";
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

.capture-btn:hover {
    transform: scale(1.1);
    background: #c0392b;
}

.capture-btn:active {
    transform: scale(0.95);
}

/* Action Buttons (Open, Retake) */
.camera-btn,
.retake-btn {
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 700;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    backdrop-filter: blur(5px);
}

.camera-btn {
    background: rgba(52, 152, 219, 0.9);
    color: white;
}

.camera-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.retake-btn {
    background: rgba(241, 196, 15, 0.9);
    color: white;
}

.retake-btn:hover {
    background: #f39c12;
    transform: translateY(-2px);
}

/* Mobile Adjustments for Controls */
@media (max-width: 576px) {
    .camera-controls {
        bottom: 15px;
        gap: 15px;
    }

    .capture-btn {
        width: 60px;
        height: 60px;
    }

    .camera-btn,
    .retake-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
}
