/* =====================================
   ✨ MAIN STYLES + PRINT OPTIMIZATION
   ===================================== */


html, body {
    margin: 0;
    padding: 0;
    height: 100%;          /* make body fill the viewport */
    width: 100%;
}
/* Reset & box-sizing */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

/* Body & typography */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f2f2f7;
    margin: 0;
    padding: 20px;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

/* Headings */
h1 {
    text-align: center;
    color: #004a99;
    margin-bottom: 30px;
}

h2 {
    margin: 0;
    padding: 10px 0; /* optional small padding if you want */
    font-size: 1.5em;
    text-align: center; /* optional */
}

/* -------------------------------------
   Forms & Inputs
------------------------------------- */
form {
    max-width: 900px;
    width: 100%;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden;
}

.form-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start; /* fix Safari stretch */
}

.form-column {
    flex: 1;
    min-width: 320px;
}

.form-group {
    margin-bottom: 8px;
}
.form-textarea {
        width: 300px;
        height: 150px;
       
    }

label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    color: #004a99;
}

/* Inputs, selects, buttons */
input[type="text"], select, button, a.button {
    width: 100%;
    padding: 5px 5px;
    font-size: 16px; /* prevents iOS zoom */
    min-height: 20px; /* Apple touch target */
    border-radius: 1px;
    border: 1px solid #ddd;
    transition: border-color 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
}

input[type="text"]:focus {
    border-color: #0078d7;
    outline: none;
    box-shadow: 0 0 6px rgba(0, 120, 215, 0.5);
}

/* Buttons */
button[type="submit"], button[type="button"], a.button {
    background: #0078d7;
    color: white;
    border: solid white;
    padding: 14px 20px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    -webkit-user-select: none;
    user-select: none;
    text-align: center;
    text-decoration: none;
}

button[type="submit"]:hover, button[type="button"]:hover, a.button:hover {
    background: #005ea3;
}

/* Multi-select adjustment */
select[multiple] {
    min-height: 120px;
    font-size: 15px;
}

/* Readonly input */
input#number.readonly-input {
    border: none;
    outline: none;
    background: transparent;
    pointer-events: none;
    font-weight: bold;
    color: #333;
}

/* Save PDF button */
#savePdfBtn {
    display: none;
    text-align: center;
    margin: 20px auto;
}

#savePdfBtn button {
    background: #28a745;
}

#savePdfBtn button:hover {
    background: #218838;
}

/* Status message */
#status {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
    font-weight: 600;
    color: #0078d7;
}

/* Video & Canvas */
video, canvas {
    border-radius: 8px;
    border: 2px solid #0078d7;
    margin-top: 10px;
    width: 240px;
    height: 180px;
    display: block;
}

/* -------------------------------------
   Tables
------------------------------------- */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    background: white;
    -webkit-border-horizontal-spacing: 0;
    -webkit-border-vertical-spacing: 0;
}

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

th {
    background: #0078d7;
    color: white;
}

td img {
    max-width: 100px;
    height: auto;
    border-radius: 6px;
}

/* -------------------------------------
   GET form filters
------------------------------------- */
form[method="GET"] {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 20px;
}

form[method="GET"] label {
    font-size: 14px;
}

form[method="GET"] input {
    min-width: 120px;
}

/* -------------------------------------
   Buttons alignment
------------------------------------- */
.btn {
    width: 50%;
    margin-left: 25%;
}
textarea {
    width:300px;
    height:300px;
}
/* -------------------------------------
   Responsive adjustments
------------------------------------- */
@media (max-width: 768px) {
    .form-container {
        flex-direction: column;
    }
    .form-column {
        min-width: 100%;
    }
    input[type="text"], button {
        font-size: 18px;
        padding: 14px 16px;
    }
    button[type="submit"] {
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }
    form[method="GET"] {
        flex-direction: column;
        align-items: stretch;
    }
    form[method="GET"] input, form[method="GET"] button, form[method="GET"] a.button {
        width: 100%;
    }
    table {
        font-size: 13px;
    }
    th, td {
        padding: 6px;
    }
    td img {
        max-width: 70px;
    }
    .btn {
        width: 100%;
        margin: 0;
    }
}

@media (max-width: 600px) {
    body {
        padding: 12px;
    }
    form {
        padding: 15px;
        border-radius: 8px;
    }
    h1 {
        font-size: 20px;
    }
    label {
        font-size: 14px;
    }
    .form-group {
        margin-bottom: 14px;
    }
    .form-textarea {
        width: 300px;
        height: 150px;
       
    }
}

/* =====================================
   🖨 PRINT STYLES (A4, 2-column)
===================================== */
/*@media print {
    @page {
        size: A4 portrait;
        margin: 15mm;
    }

    body * {
        visibility: hidden !important;
    }

    #computerForm, #computerForm * {
        visibility: visible !important;
    }

    #computerForm {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white !important;
        box-shadow: none !important;
        margin: 0;
        padding: 10mm;
        font-size: 11pt;
        column-count: 2;
        column-gap: 20mm;
        column-fill: balance;
        page-break-inside: avoid;
    }

    #computerForm::before {
        content: "PC ASSET Number " attr(data-number);
        display: block;
        text-align: center;
        font-size: 16pt;
        font-weight: bold;
        color: black;
        margin-bottom: 15px;
    }

    #assetNum {
        color: #000 !important;
        font-weight: bold !important;
        visibility: visible !important;
    }

     Hide unnecessary elements 
    #savePdfBtn, #status, video, canvas, button, a.button {
        display: none !important;
    }

    .form-container {
        display: block !important;
    }

    .form-column {
        width: 100% !important;
        display: block !important;
        break-inside: avoid;
    }

    .form-group {
        margin-bottom: 6px !important;
        border-bottom: 1px solid #ccc !important;
        padding-bottom: 3px !important;
        page-break-inside: avoid;
    }
    .form-textarea {
        width: 300px;
        height: 150px;
       
    }

    label, input, select {
        font-weight: bold !important;
        color: #000 !important;
        display: block !important;
        width: 100% !important;
        border: none !important;
        background: none !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
    }
    #liveClock {
    display: none !important;
    
}
  
}*/

@media print {

    @page {
        size: A4 portrait;
        margin: 0; /* 🔥 remove default browser margin */
    }

    html, body {
        margin: 0 !important;
        padding: 20mm !important; /* manual page margin */
        background: #fff !important;
    }

    /* Hide buttons */
    .top-actions,
    .sticky-actions,
    .bottom-actions,
    button,
    a.button {
        display: none !important;
    }

    /* Hide all fields first */
    .form-group {
        display: none !important;
    }

    /* Show only selected fields */
    .field-number,
    .field-brand,
    .field-description,
    .field-serial,
    .field-file_path {
        display: block !important;
    }

    /* Clean form */
    form {
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Remove Browse button */
    .field-file_path input[type="file"],
    .field-file_path input[type="hidden"] {
        display: none !important;
    }

    /* Text formatting */
    label {
        font-size: 14pt;
        font-weight: bold;
        color: #000 !important;
    }

    input[type="text"] {
        border: none !important;
        background: none !important;
        padding: 0 !important;
        font-size: 13pt;
        font-weight: 500;
        color: #000 !important;
    }

    /* Image size */
    .field-file_path img {
        max-width: 350px !important;
        border: 1px solid #000;
        padding: 5px;
        margin-top: 10px;
    }
}
  /* ===============================
   ⏰ Top Right Live Clock
================================= */
/* ⏰ Clock inside form (top-right) */
#liveClock {
    position: absolute;
    top: 15px;
    right: 20px;
    text-align: right;
    font-size: 15px;
    font-weight: 600;
    color: green;
    line-height: 1.4;
}
/* Make form a positioning container */
#computerForm {
    position: relative;
}
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.checkbox-group label {
    font-weight: normal;
    font-size: 14px;
}
/* ===============================
   iOS Safari Fixed Bottom Bar
================================= */

.ios-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    gap: 10px;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: #ffffff;
    border-top: 1px solid #ccc;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    z-index: 9999;
}

/* Prevent content from hiding behind bar */
body {
    padding-bottom: 90px;
}

/* Buttons inside bar */
.ios-action-bar button {
    flex: 1;
    padding: 12px 10px;
    font-size: 16px;
    border-radius: 8px;
    border: none;
    color: #fff;
}

/* Individual colors */
.ios-action-bar .update-btn .submit-btn {
    background-color: #28a745;
}

.ios-action-bar .back-btn .logout-btn .list-btn .hdd-list {
    background-color: #6c757d;
}

.ios-action-bar .print-btn .logout-btn .list-btn .hdd-list {
    background-color: #007BFF;
}
/* Top actions (Cancel + Print) */
.top-actions {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin: 10px 0;
}

.top-actions .back-btn .logout-btn .list-btn .hdd-list,
.top-actions .print-btn .logout-btn .list-btn .hdd-list {
    padding: 6px 3px;
    border-radius: 4px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    color: #fff;
    background-color: #6c757d; /* gray for cancel/back */
    transition: background 0.2s;
}

.top-actions .back-btn:hover,
.top-actions .print-btn:hover {
    background-color: #5a6268;
}

/* Sticky Update button */
/*.sticky-actions {
    position: sticky;
    bottom: 0;
    background-color: #fff;
    padding: 10px 0;
    z-index: 999;
    border-bottom: 1px solid #ccc;
    text-align: right;  float to right 
}

.sticky-actions .update-btn .submit-btn {
    padding: 8px 16px;
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.sticky-actions .update-btn:hover .submit-btn:hover {
    background-color: #218838;
}*/
/* Bottom fixed Update button */
.bottom-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    background-color: #fff;
    border-top: 1px solid #ccc;
    text-align: right; /* button on the right */
    z-index: 999;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
}

.bottom-actions .update-btn .submit-btn {
    padding: 10px 20px;
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.bottom-actions .update-btn:hover .submit-btn:hover{
    background-color: #218838;
}

/* Enlarged image overlay */
.preview-img.enlarged {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.8);
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    z-index: 9999;
    box-shadow: 0 0 25px rgba(0,0,0,0.6);
    border-radius: 6px;
    background: white;
    cursor: zoom-out;
}

/* Optional dark background */
.image-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9998;
}

.dynamic-btn {
    color: white;
    background-color: green;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dynamic-btn:hover {
    background-color: darkgreen;
}