
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: #f4f4f4;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: #fff;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

header {
    margin-bottom: 20px;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

header .header-text {
    flex: 1;
    min-width: 200px;
}

header h1 {
    font-size: 20px;
    font-weight: bold;
    color: #000;
}

header h2 {
    font-size: 16px;
    font-weight: bold;
    color: #000;
}

.view-submissions-link,
.back-link {
    display: inline-block;
    padding: 10px 18px;
    background-color: #e67e22;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    text-align: center;
}

.back-link {
    background-color: #3498db;
    margin-bottom: 20px;
}

/* Wrap the table so it can scroll horizontally as a fallback on
   medium screens before the card layout kicks in on phones */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#formTable {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

#formTable th, #formTable td {
    border: 1px solid #000;
    padding: 8px;
    text-align: center;
    font-size: 12px;
}

#formTable th {
    background-color: #2c3e50;
    color: #fff;
    font-weight: bold;
}

#formTable input[type="text"],
#formTable input[type="date"] {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    font-size: 12px;
}

#formTable input[type="file"] {
    font-size: 10px;
    width: 100%;
}

.sample-preview {
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.button-group {
    display: flex;
    gap: 10px;
}

button {
    padding: 10px 20px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

button:hover {
    background-color: #219a52;
}

#addRowBtn {
    background-color: #3498db;
}

#addRowBtn:hover {
    background-color: #2980b9;
}

/* ===================== Tablet ===================== */
@media (max-width: 900px) {
    .container {
        padding: 16px;
    }
}

/* ===================== Mobile: stack cards ===================== */
@media (max-width: 700px) {
    body {
        padding: 8px;
    }

    .container {
        padding: 12px;
        box-shadow: none;
    }

    header {
        text-align: center;
        justify-content: center;
    }

    header h1 {
        font-size: 17px;
    }

    header h2 {
        font-size: 13px;
    }

    .view-submissions-link {
        width: 100%;
    }

    /* Turn the whole table into a stack of cards: hide the header
       row and let each <tr> become a self-contained block with its
       cells labelled via data-label */
    #formTable thead {
        display: none;
    }

    #formTable, #formTable tbody, #formTable tr, #formTable td {
        display: block;
        width: 100%;
    }

    #formTable {
        border: none;
    }

    #formTable tbody tr {
        margin-bottom: 16px;
        border: 1px solid #ccc;
        border-radius: 8px;
        overflow: hidden;
        background-color: #fafafa;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    #formTable td {
        border: none;
        border-bottom: 1px solid #e6e6e6;
        text-align: left;
        padding: 10px 12px;
    }

    #formTable td:last-child {
        border-bottom: none;
    }

    #formTable td::before {
        content: attr(data-label);
        display: block;
        font-weight: bold;
        font-size: 10px;
        letter-spacing: 0.03em;
        text-transform: uppercase;
        color: #2c3e50;
        margin-bottom: 5px;
    }

    /* Row number acts like a card header */
    #formTable td[data-label="No."] {
        background-color: #2c3e50;
        color: #fff;
        font-size: 14px;
        font-weight: bold;
        padding: 8px 12px;
    }

    #formTable td[data-label="No."]::before {
        display: none;
    }

    /* Inputs at 16px prevent iOS Safari from auto-zooming on focus,
       and taller inputs are easier to tap accurately */
    #formTable input[type="text"],
    #formTable input[type="date"] {
        font-size: 16px;
        padding: 10px;
        min-height: 40px;
    }

    #formTable input[type="file"] {
        font-size: 13px;
    }

    .sample-preview {
        max-width: 100% !important;
        height: auto;
    }

    .button-group {
        flex-direction: column;
    }

    button {
        width: 100%;
        padding: 14px;
        font-size: 16px;
    }
}
