:root {
    --steadfast-glow: 0 0 15px rgba(231, 76, 60, 0.5);
    --redx-glow: 0 0 15px rgba(52, 152, 219, 0.5);
    --pathao-glow: 0 0 15px rgba(243, 156, 18, 0.5);
    --paperfly-glow: 0 0 15px rgba(155, 89, 182, 0.5);
}

#tracker-interface {
    padding: 140px 0 80px 0;
    min-height: 100vh;
}

.search-wrapper {
    max-width: 600px;
    margin: 0 auto 40px;
    text-align: center;
}

.search-wrapper h2 {
    font-size: 2.8rem;
}

.search-wrapper p {
    font-size: 1.1rem;
    color: var(--secondary-text-color);
    margin-top: -10px;
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    background: var(--secondary-color);
    border-radius: 50px;
    border: 1px solid var(--border-color);
    padding: 8px;
    transition: all 0.3s ease;
}

.input-group:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(0, 191, 255, 0.3);
}

#mobile-input {
    flex-grow: 1;
    border: none;
    background: transparent;
    padding: 10px 20px;
    font-size: 1.2rem;
    color: var(--text-color);
    min-width: 0;
}

#mobile-input:focus {
    outline: none;
}

#search-btn {
    background: var(--accent-color);
    color: #0A0A0A;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#search-btn:hover {
    background: #fff;
    box-shadow: 0 0 20px var(--accent-color);
}

/* --- Results Styling --- */
.results-master-panel,
.courier-card,
.chart-panel {
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    margin-bottom: 30px;
    animation: fadeInUp 0.5s ease-out forwards;
}

.results-master-panel {
    padding: 30px;
    text-align: center;
}

.panel-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat .value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

.stat .label {
    color: var(--secondary-text-color);
}

.progress-bar-container {
    margin-top: 10px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--secondary-color);
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar-inner {
    height: 100%;
    width: 0%;
    background: var(--accent-color);
    border-radius: 6px;
    transition: width 1s ease-out;
}

.progress-label {
    text-align: right;
    font-weight: 600;
}

.courier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.courier-card {
    padding: 25px;
    transition: all 0.3s ease;
}

.courier-card h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.courier-card p {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.courier-card p:last-child {
    border-bottom: none;
}

.courier-card span {
    font-weight: 600;
    color: var(--text-color);
}

.courier-card.steadfast:hover { box-shadow: var(--steadfast-glow); }
.courier-card.redx:hover { box-shadow: var(--redx-glow); }
.courier-card.pathao:hover { box-shadow: var(--pathao-glow); }
.courier-card.paperfly:hover { box-shadow: var(--paperfly-glow); }

.chart-panel {
    padding: 30px;
}

.bar-chart .bar {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.bar-label {
    width: 100px;
}

.bar-wrapper {
    flex-grow: 1;
    background: var(--secondary-color);
    border-radius: 5px;
}

.bar-inner {
    height: 20px;
    border-radius: 5px;
    width: 0%;
    transition: width 1s ease-out;
}

.bar-value {
    padding-left: 10px;
    font-weight: 600;
}

/* Loader and Error */
#loader {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    margin: 30px auto;
    animation: spin 1s linear infinite;
}

#error-message {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

/* Animation */
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.courier-grid-title {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-color);
    margin-top: 40px;
    margin-bottom: 20px;
}

/* =========================================== */
/* Responsive Styles for Mobile and Tablet     */
/* =========================================== */

/* For Tablets (up to 992px) */
@media (max-width: 992px) {
    .courier-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    .search-wrapper h2 {
        font-size: 2.5rem;
    }
    .panel-title {
        font-size: 1.4rem;
    }
}

/* For Mobile Devices (up to 576px) */
@media (max-width: 576px) {
    #tracker-interface {
        padding: 120px 15px 60px 15px; /* Add horizontal padding */
    }
    .search-wrapper h2 {
        font-size: 20px; /* Reduce font size further */
    }
    .search-wrapper p {
        font-size: 12px;
    }

    .input-group {
        flex-direction: column; /* Stack input and button vertically */
        border-radius: 10px;
        padding: 10px;
        gap: 10px;
    }
    #mobile-input {
        text-align: center;
        font-size: 1.1rem;
        padding: 12px;
    }
    #search-btn {
        border-radius: 8px; /* Match the new border-radius */
    }

    .results-master-panel {
        padding: 20px;
    }

    /********** NEW HORIZONTAL STYLE FOR SUMMARY STATS ON MOBILE **********/
    .summary-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background-color: var(--primary-color);
        padding: 15px 20px;
        border-radius: 10px;
        border: 1px solid var(--border-color);
        box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    }
    
    body.light-mode .stat {
        background-color: #f8f9fa;
    }

    .stat .label {
        order: 1; /* Label appears first (left) */
        font-size: 1rem;
        font-weight: 500;
        color: var(--secondary-text-color);
    }

    .stat .value {
        order: 2; /* Value appears second (right) */
        font-size: 2.2rem;
        margin-bottom: 0;
    }
    /********** END OF NEW STYLE **********/
    
    .courier-grid {
        grid-template-columns: 1fr; /* Single column layout */
        gap: 20px;
    }
    .courier-card {
        padding: 20px;
    }
    .courier-card h3 {
        font-size: 1.5rem;
    }
    .chart-panel {
        padding: 20px 15px;
    }
    .bar-chart .bar {
        flex-wrap: wrap; /* Allow wrapping */
    }
    .bar-label {
        width: 80px;
        font-size: 0.9rem;
    }
    .bar-value {
        font-size: 0.9rem;
    }
    .courier-grid-title {
        font-size: 1.5rem;
    }
}