/* 
==============================================================================
    MASTER RESPONSIVE STYLESHEET (START-FRAMING MODULE)
    Handles 4-Tier Breakpoints: 1440px, 1024px, 768px, 425px
==============================================================================
*/

/* -------------------------------------------------------------------------
   BREAKPOINT: 1440px (Desktop / Large Monitors)
   ------------------------------------------------------------------------- */
@media screen and (max-width: 1440px) {

    .container,
    .dashboard-container,
    .main-content {
        max-width: 1100px;
    }

    .sub-titles h1,
    header h1 {
        font-size: 42px;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }

    /* Form spacing */
    .framingOptions,
    #spacersSection,
    #floatingSection,
    #clipsesSection,
    #objectSection,
    #canvasDrawingSection {
        gap: 15px 30px;
    }
}

/* -------------------------------------------------------------------------
   BREAKPOINT: 1024px (Laptops / Landscape Tablets)
   ------------------------------------------------------------------------- */
@media screen and (max-width: 1024px) {

    .container,
    .dashboard-container,
    .main-content {
        max-width: 900px;
        padding: 30px;
        margin: 30px auto;
        gap: 1.2rem;
    }

    .card h3 {
        font-size: 1.1rem;
    }

    .sub-titles h1,
    header h1 {
        font-size: 36px;
    }

    header.sub-titles,
    .sub-titles {
        padding: 50px 30px;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }

    /* Dashboard & Card Layouts */
    .dashboard-container,
    .cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    /* Form Spacing for Laptops */
    .framingOptions,
    #matting_section,
    #background_section,
    #doubleGlassSection,
    #boxFrame_section {
        gap: 15px 20px;
    }

    .input {
        min-width: 240px;
    }
}

/* -------------------------------------------------------------------------
   BREAKPOINT: 768px (Tablets / Portait View) 
   CRITICAL: Forces single-column grids and squashes padded containers.
   ------------------------------------------------------------------------- */
@media screen and (max-width: 768px) {

    /* Layouts */
    .container,
    .main-content {
        margin: 20px 15px;
        padding: 20px 15px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .dashboard-container {
        grid-template-columns: 1fr;
        padding: 1.5rem;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }

    /* Typography */
    .sub-titles h1,
    header h1 {
        font-size: 32px;
    }

    h2 {
        font-size: 26px;
        margin-bottom: 20px;
    }

    /* Headers & Navigation */
    header.sub-titles,
    .sub-titles {
        padding: 40px 20px;
    }

    .tabs-container {
        gap: 8px;
    }

    .tab-button {
        font-size: 14px;
        padding: 10px 18px;
    }

    /* Forms & Actions */
    .button-group,
    .product-actions,
    .btns {
        flex-direction: column;
    }

    button[type="submit"],
    .btn-cancel,
    .add-product-button {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }

    .add-product-button {
        font-size: 16px;
        padding: 12px 25px;
        display: block;
    }

    /* Dashboard Elements */
    .dashboard-container,
    .cards {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
        padding: 1rem;
    }

    .card {
        background: white;
        padding: 20px;
        border-radius: 10px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
        text-decoration: none;
        color: inherit;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: transform 0.2s, box-shadow 0.2s;
    }

    .card:hover {
        transform: translateY(-5px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .card h3 {
        color: #012c58;
        margin-bottom: 10px;
        font-size: 1.25rem;
    }

    .charts {
        display: flex;
        gap: 30px;
        flex-wrap: wrap;
        margin-bottom: 30px;
    }

    .chart-box {
        flex: 1;
        min-width: 300px;
        background: white;
        padding: 20px;
        border-radius: 10px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    }

    .main-content {
        padding: 20px;
    }

    @media screen and (min-width: 1024px) {
        .main-content {
            padding: 30px 60px;
        }
    }

    /* Dashboards, Cards & Tables */
    .dashboard-container,
    .cards,
    .tables {
        grid-template-columns: 1fr !important;
        padding: 1rem;
        gap: 15px;
    }

    .card {
        max-width: 100% !important;
        margin-bottom: 10px;
    }

    .topbar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 15px;
    }

    .table-container {
        padding: 10px !important;
        margin: 10px 0;
    }

    table {
        width: 100% !important;
        display: block;
        overflow-x: auto;
    }

    .charts,
    .chart-box {
        flex-direction: column;
        width: 100% !important;
        min-width: 100% !important;
    }

    /* Images */
    .product-image {
        height: 180px;
    }

    /* Art Module specific */
    .artist-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .artist-header h2 {
        font-size: 20px;
    }

    /* Forms Module specific */
    .product .displayProduct {
        width: 90%;
    }

    .product .displayProduct form .dimensions .input,
    .product .displayProduct form .framingOptions .input,
    .product .displayProduct form .input {
        width: 100% !important;
    }

    /* Extracted Form Overrides */
    #matting_section,
    #background_section,
    #doubleGlassSection {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    #boxFrame_section {
        grid-template-columns: 1fr !important;
    }

    .box-frame-column {
        border-bottom: 1px solid #eee;
        padding-bottom: 15px;
    }

    .input input[type="text"],
    .input input[type="number"],
    .input select,
    .select2-container {
        max-width: 100% !important;
    }
}

/* -------------------------------------------------------------------------
   BREAKPOINT: 425px (Mobile Displays)
   CRITICAL: Maximizes screen usage, reduces text scale for long strings.
   ------------------------------------------------------------------------- */
@media screen and (max-width: 425px) {

    /* Layouts */
    .container,
    .main-content {
        margin: 8px 10px;
        padding: 15px 10px;
    }

    .dashboard-container {
        padding: 1rem;
        gap: 1rem;
    }

    .card {
        padding: 1rem;
    }

    /* Typography */
    .card h3 {
        font-size: 1rem;
    }

    .sub-titles h1,
    header h1 {
        font-size: 26px;
        margin-bottom: 20px;
    }

    h2 {
        font-size: 22px;
        margin-bottom: 15px;
    }

    .form-group label,
    label {
        font-size: 13px;
    }

    /* Headers & Navigation */
    header.sub-titles,
    .sub-titles {
        padding: 30px 15px;
    }

    .tab-button {
        font-size: 13px;
        padding: 8px 12px;
        flex: 1;
    }

    /* Forms & Actions */
    input[type="text"],
    input[type="number"],
    input[type="file"],
    input[type="date"],
    select,
    textarea {
        padding: 8px;
        font-size: 14px;
        width: 100%;
        box-sizing: border-box;
    }

    .add-product-button,
    .btns button {
        font-size: 14px;
        padding: 10px 20px;
    }

    /* Products */
    .product-image {
        height: 160px;
    }

    .product-details {
        padding: 15px;
    }

    .product-actions {
        padding: 0 15px 15px;
    }

    .product-details h3 {
        font-size: 16px;
    }

    .product-details p {
        font-size: 13px;
    }

    .product-actions button,
    .product-actions a {
        justify-content: center;
    }

    /* Forms Module specific */
    .product .displayProduct {
        width: 95%;
        padding: 15px;
    }

    /* Extracted Form Overrides */
    #matting_section,
    #background_section,
    #doubleGlassSection,
    #boxFrame_section {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .input {
        flex-direction: column;
        align-items: flex-start;
        min-width: 100%;
        gap: 5px;
        margin-bottom: 10px;
    }

    .input label {
        text-align: left;
        min-width: auto;
        margin-bottom: 2px;
    }

    /* Select Overrides */
    .input input[type="text"],
    .input input[type="number"],
    .input select,
    .select2-container {
        max-width: 100% !important;
        width: 100% !important;
    }

    #checkoutBtn,
    .btn {
        width: 100%;
        display: block;
    }
}

/* --- Daily Operations & Dashboard Utilities --- */

/* Signal Indicator & Pulse Animation */
.signal-indicator {
    background-color: #3498db;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-left: 10px;
    vertical-align: middle;
    font-weight: bold;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 6px rgba(52, 152, 219, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
    }
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
}

.badge-approved {
    background-color: #27ae60;
}

.badge-pending {
    background-color: #95a5a6;
}

/* Stats & Archive Cards */
.stats-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    flex: 1;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #1abb9c;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.3rem;
}

.archive-info {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

/* Kanban / Task Dashboard Specifics */
.kanban-container {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    gap: 15px;
    overflow-x: auto;
    min-height: 80vh;
}

.column {
    flex: 1;
    min-width: 280px;
    background-color: #f8f9fa;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    padding: 10px;
}

.column-header {
    padding: 10px 5px;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}

.card.kanban-card {
    background-color: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    cursor: grab;
    align-items: flex-start;
    text-align: left;
}

.card.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Utility Classes */
.hidden-section {
    display: none !important;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
    font-size: 1.25rem;
    font-weight: bold;
    color: #2a3f54;
}

.modal-footer {
    border-top: 1px solid #eee;
    padding-top: 15px;
    margin-top: 20px;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Form Controls */
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    margin: 8px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: inherit;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #219150;
}

/* Charts & Dashboard Layouts */
.chart-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    padding: 1rem;
}

.chart-box {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
    .chart-container {
        grid-template-columns: 1fr;
    }
}

/* --- Invoice Experimental Form Optimization --- */

/* Form Container */
#paper-onsize {
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* Grouping Sections */
.dimensions,
.framingOptions,
#matting_section,
#background_section,
#boxFrame_section,
#doubleGlassSection,
#floatingSection,
#clipsesSection,
#objectSection,
#canvasDrawingSection,
#spacersSection {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #edf2f7;
    align-items: end;
}

.dimensions p,
.framingOptions p,
#matting_section p,
#background_section p,
#boxFrame_section p,
#doubleGlassSection p,
#floatingSection p,
#clipsesSection p,
#objectSection p,
#canvasDrawingSection p,
#spacersSection p {
    grid-column: 1 / -1;
    margin: 0;
    font-weight: bold;
    color: #2c3e50;
    font-size: 1.1rem;
    padding-bottom: 5px;
    border-bottom: 2px solid #3498db;
}

/* Inputs & Labels */
.input {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a5568;
}

/* Special Case Sections */
#matting_section,
#background_section {
    grid-template-columns: repeat(3, 1fr);
}

.matting-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
}

.matting-row.special-layer {
    grid-template-columns: repeat(4, 1fr);
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    border: 1px dashed #cbd5e0;
}

.matting-row.special-layer p {
    grid-column: 1 / -1;
    font-size: 0.9rem !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e8f0 !important;
    color: #718096 !important;
}

.background-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
    background: #ffffff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.background-row p {
    grid-column: 1 / -1;
    font-size: 0.9rem !important;
    font-weight: 600;
    color: #4a5568 !important;
    margin-bottom: 5px !important;
    border-bottom: 1px solid #edf2f7 !important;
}

.double-glass-row,
.canvas-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
    background: #ffffff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.double-glass-row {
    grid-template-columns: repeat(2, 1fr);
}

.box-frame-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.box-frame-column p {
    font-size: 0.95rem !important;
    border-bottom: 1px solid #ddd !important;
    padding-bottom: 3px !important;
    margin-bottom: 5px !important;
}

/* Checkbox Alignment */
.standalone-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    background: #ebf8ff;
    border-radius: 8px;
    border-left: 4px solid #3182ce;
    font-weight: 600;
}

.standalone-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Breakpoints for Dense Form */

/* 1024px - Tablet Landscape */
@media (max-width: 1024px) {

    .dimensions,
    .framingOptions,
    #boxFrame_section,
    #doubleGlassSection,
    #floatingSection,
    #clipsesSection,
    #objectSection,
    #canvasDrawingSection,
    #spacersSection {
        grid-template-columns: repeat(3, 1fr);
    }

    #boxFrame_section {
        grid-template-columns: repeat(3, 1fr);
    }

    #matting_section,
    #background_section {
        grid-template-columns: repeat(3, 1fr);
        /* Keep 3 on laptop as inputs are small */
    }

    .matting-row.special-layer {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 768px - Tablet Portrait */
@media (max-width: 768px) {

    .dimensions,
    .framingOptions,
    #boxFrame_section,
    #doubleGlassSection,
    #floatingSection,
    #clipsesSection,
    #objectSection,
    #canvasDrawingSection,
    #spacersSection {
        grid-template-columns: repeat(2, 1fr);
    }

    #boxFrame_section {
        grid-template-columns: repeat(2, 1fr);
    }

    #matting_section,
    #background_section {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on tablet */
    }

    .matting-row.special-layer {
        grid-template-columns: 1fr;
    }

    .matting-row,
    .background-row,
    .double-glass-row,
    .canvas-row {
        grid-template-columns: 1fr;
        padding: 10px;
    }
}

/* 425px - Mobile */
@media (max-width: 425px) {

    .dimensions,
    .framingOptions,
    #boxFrame_section,
    #doubleGlassSection,
    #floatingSection,
    #clipsesSection,
    #objectSection,
    #canvasDrawingSection,
    #spacersSection {
        grid-template-columns: 1fr;
    }

    #matting_section,
    #background_section {
        grid-template-columns: 1fr;
    }

    .standalone-checkbox {
        flex-direction: row-reverse;
        justify-content: space-between;
    }
}