/* --------------------------
   Reset and Base Styles
--------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
    padding: 20px;
    font-size: 16px;
}

a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    margin-bottom: 15px;
    color: #222;
}

/* --------------------------
   Table Styles
--------------------------- */

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    table-layout: auto;
}

table th, table td {
    border: 1px solid #dee2e6;
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
}

table th {
    background-color: #007bff;
    color: #fff;
    font-weight: 500;
}

table td {
    background-color: #fff;
    word-break: break-word;
}

table td:nth-child(1) {
    font-weight: 500;
}

/* Inputs inside tables */

table td input[type="number"] {
    width: 70px;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* --------------------------
   Printing Images
--------------------------- */

.image-row td {
    text-align: center;
    background-color: #fdfdfd;
    padding: 15px 0;
}

.printing-image {
    max-width: 250px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    margin: 10px auto;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.printing-image:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 14px rgba(0,0,0,0.25);
}

/* --------------------------
   Buttons
--------------------------- */

input[type="submit"], button {
    background-color: #007bff;
    color: #fff;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.2s ease-in-out;
}

input[type="submit"]:hover,
button:hover {
    background-color: #0056b3;
}

/* Disabled Add Button */

button.disabled-btn {
    background-color: #adb5bd;
    cursor: not-allowed;
    opacity: 0.65;
}

button.disabled-btn:hover {
    background-color: #adb5bd;
}

/* --------------------------
   Links
--------------------------- */

p a {
    display: inline-block;
    margin-bottom: 15px;
}

.back-link {
    font-weight: 500;
}

/* --------------------------
   Success Message
--------------------------- */

.success {
    background-color: #d4edda;
    color: #155724;
    padding: 12px 15px;
    margin-bottom: 15px;
    border-radius: 6px;
    border: 1px solid #c3e6cb;
}

/* --------------------------
   Warning Message
--------------------------- */

.warning {
    background-color: #fff3cd;
    color: #856404;
    padding: 12px 15px;
    margin-bottom: 15px;
    border-radius: 6px;
    border: 1px solid #ffeeba;
    font-weight: 500;
}

/* --------------------------
   Deck Builder Layout
--------------------------- */

.deck-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: nowrap;
}

.deck-section {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Scrollable card lists */

.scroll-box {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    background: #fff;
    padding: 8px;
    border-radius: 6px;
}

.scroll-box table {
    width: 100%;
    table-layout: fixed;
}

/* --------------------------
   ✅ FIX: Ellipsis ONLY for deck section
--------------------------- */

.deck-section .scroll-box td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------------------------
   Add Card Table Wrapping
--------------------------- */

.add-card-table td {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.add-card-table th {
    white-space: nowrap;
}

/* --------------------------
   Search + Filter Controls
--------------------------- */

#cardSearch,
#typeFilter,
input[type="text"],
input[type="number"],
select {

    padding: 8px 10px;
    margin-bottom: 10px;
    margin-right: 8px;

    border: 1px solid #ccc;
    border-radius: 5px;

    font-size: 15px;
}

/* --------------------------
   Forms
--------------------------- */

form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* --------------------------
   Responsive Design
--------------------------- */

@media (max-width: 900px) {

    body {
        padding: 12px;
        font-size: 17px;
    }

    .deck-layout {
        flex-direction: column;
    }

    .scroll-box {
        max-height: none;
    }

}

/* Mobile phones */

@media (max-width: 600px) {

    body {
        padding: 10px;
        font-size: 18px;
    }

    h1 {
        font-size: 22px;
    }

    table {
        font-size: 16px;
    }

    th, td {
        padding: 10px;
    }

    input,
    select,
    button {
        font-size: 16px;
        padding: 10px;
    }

    /* Convert tables to mobile cards */

    table, thead, tbody, th, td, tr {
        display: block;
        width: 100%;
    }

    table tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 6px;
        overflow: hidden;
    }

    table th {
        display: none;
    }

    table td {
        padding: 10px;
        text-align: right;
        position: relative;
    }

    table td::before {

        content: attr(data-label);

        position: absolute;
        left: 10px;

        width: 50%;

        font-weight: 600;
        text-align: left;
    }

    table td input[type="number"] {
        width: 100%;
    }

    /* Smaller images on phones */

    .printing-image {
        max-width: 200px;
    }

}