/* -------------------------------------------------------------------------
   FACTORY DASHBOARD & CARDS
   ------------------------------------------------------------------------- */

.main-content {
    padding: 30px 60px;
}

.topbar {
    background-color: white;
    padding: 15px 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px;
}

.topbar h1 {
    color: #012c58;
    font-size: 1.8em;
    font-weight: 600;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    color: #012c58;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    border: 1px solid #edf2f7;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.1);
}

.card h3 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 700;
}

/* Factory Phase Specific Gradient */
.card.factory {
    background: linear-gradient(135deg, #56ccf2, #2f80ed);
    border: none;
}

.card.factory h3 {
    color: white;
}

/* Factory Phase Cards (Special Styling) */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}

.phase-card {
    background: white;
    padding: 32px 24px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.phase-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.phase-card:hover::before {
    transform: scaleX(1);
}

.phase-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.18);
}

.phase-card .icon {
    font-size: 3.6em;
    margin-bottom: 12px;
    display: block;
}

.phase-card h3 {
    margin: 16px 0 8px;
    font-size: 1.5em;
    font-weight: 700;
    color: #012c58;
}

.phase-card p {
    color: #666;
    font-size: 0.95em;
    margin: 0;
}

/* -------------------------------------------------------------------------
   COMMON OPERATIONS & TABLES
   ------------------------------------------------------------------------- */

.table-container {
    padding: 2rem;
    overflow-x: auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th,
td {
    padding: 1rem;
    border-bottom: 1px solid #edf2f7;
    text-align: center;
    vertical-align: middle;
    color: #4a5568;
    font-size: 0.95rem;
}

th {
    background-color: #2d3748;
    color: white;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Status Pills & Badges */
.status-pill,
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: white;
    white-space: nowrap;
}

.badge-finished {
    background-color: #38a169;
}

.badge-matting {
    background-color: #805ad5;
}

.badge-sanding {
    background-color: #d69e2e;
}

.badge-glass {
    background-color: #3182ce;
}

.badge-cutting {
    background-color: #e53e3e;
}

.badge-pending {
    background-color: #a0aec0;
}

.badge-coloring {
    background-color: #ed8936;
}

/* Interactive Toggle Buttons */
.toggle-btn {
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.toggle-yes {
    background: #f0fff4;
    color: #2f855a;
    border-color: #c6f6d5;
}

.toggle-no {
    background: #fff5f5;
    color: #c53030;
    border-color: #fed7d7;
}

/* Item Row Details (Daily Chart) */
.item-row {
    padding: 15px;
    border-bottom: 1px solid #edf2f7;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 10px;
    text-align: left;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

/* -------------------------------------------------------------------------
   STATION / QUEUE OPERATIONS (PHASES)
   ------------------------------------------------------------------------- */

.station-container {
    background-color: #030712;
    /* gray-950 */
    color: white;
    min-height: 100vh;
}

.station-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 24px;
}

.station-card {
    background-color: #111827;
    /* gray-900 */
    border-radius: 12px;
    border: 4px solid #374151;
    /* gray-700 */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}

.station-card.started {
    border-color: #eab308;
    /* yellow-500 */
}

.station-card-header {
    padding: 16px;
    border-bottom: 1px solid #1f2937;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.station-card-header .id-tag {
    font-size: 0.8rem;
    color: #9ca3af;
    font-weight: 700;
}

.station-card-header h2 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-top: 4px;
    line-height: 1.2;
}

.station-card-body {
    padding: 16px;
    flex-grow: 1;
}

.station-specs {
    margin-bottom: 12px;
}

.station-specs .label {
    font-weight: 700;
    color: #d1d5db;
    font-size: 0.85rem;
}

.station-specs .value {
    font-family: monospace;
    font-size: 1.1rem;
    display: block;
}

.station-notes {
    background: #1f2937;
    padding: 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    color: #d1d5db;
    margin-top: 8px;
    white-space: pre-wrap;
}

.station-prev-info {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #374151;
}

.station-prev-info .title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

.station-timer {
    background-color: #1f2937;
    margin: 16px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 1.75rem;
    font-weight: 800;
    font-family: monospace;
    color: #eab308;
}

.station-actions {
    padding: 16px;
    border-top: 1px solid #1f2937;
}

.station-btn {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s;
}

.station-btn-start {
    background: #16a34a;
    color: white;
}

.station-btn-start:hover {
    background: #15803d;
}

.station-btn-finish {
    background: #dc2626;
    color: white;
}

.station-btn-finish:hover {
    background: #b91c1c;
}

input.station-input {
    width: 100%;
    background: #030712;
    border: 1px solid #374151;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

/* -------------------------------------------------------------------------
   4-TIER RESPONSIVE BREAKPOINTS
   ------------------------------------------------------------------------- */

@media screen and (max-width: 1440px) {

    .main-content,
    .table-container {
        padding: 25px 40px;
    }

    table {
        font-size: 0.9em;
    }

    .badge,
    .status-pill {
        padding: 3px 8px;
        font-size: 0.7rem;
    }

    .item-row {
        padding: 12px;
    }

    .station-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 1024px) {

    .main-content,
    .table-container {
        padding: 20px 30px;
    }

    .cards,
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .topbar h1 {
        font-size: 1.5em;
    }

    .phase-card h3 {
        font-size: 1.3em;
    }

    table {
        font-size: 0.85em;
    }

    th,
    td {
        padding: 0.8rem;
    }

    .badge,
    .status-pill {
        padding: 2px 6px;
        font-size: 0.65rem;
    }

    .item-row {
        padding: 10px;
    }

    .station-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media screen and (max-width: 768px) {

    .main-content,
    .table-container {
        padding: 15px 15px;
    }

    .cards,
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .topbar {
        padding: 12px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .topbar h1 {
        font-size: 1.3em;
    }

    .card h3 {
        font-size: 1.2em;
    }

    .phase-card {
        padding: 20px 15px;
    }

    .phase-card .icon {
        font-size: 2.8em;
    }

    .phase-card h3 {
        font-size: 1.15em;
    }

    table {
        font-size: 0.8em;
    }

    th,
    td {
        padding: 0.6rem;
    }

    .badge,
    .status-pill {
        padding: 2px 5px;
        font-size: 0.6rem;
    }

    .item-row {
        padding: 8px;
    }

    .station-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 15px;
    }
}

@media screen and (max-width: 425px) {

    .main-content,
    .table-container {
        padding: 10px;
    }

    .cards,
    .grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    th,
    td {
        padding: 6px;
        font-size: 0.75rem;
    }

    .topbar h1 {
        font-size: 1.2em;
    }

    .card {
        padding: 20px;
        min-height: 100px;
    }

    .card h3 {
        font-size: 1.1em;
    }

    .phase-card {
        padding: 18px;
        border-radius: 12px;
    }

    .phase-card .icon {
        font-size: 2.2em;
    }

    .phase-card h3 {
        font-size: 1.1em;
    }

    table {
        font-size: 0.75em;
    }

    .badge,
    .status-pill {
        padding: 2px 4px;
        font-size: 0.6rem;
    }

    .item-row {
        padding: 10px;
    }
}