/* General Body and Container Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6; /* Light background */
    color: #333;
    line-height: 1.6;
}

.header {
    background-color: #279d9e; /* We Love Collectibles Brand Color */
    color: white;
    padding: 20px 0; 
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex; 
    align-items: center; 
    justify-content: center; 
    min-height: 80px; 
    position: relative; /* Added for absolute positioning of logout btn */
}

.header h1 {
    font-family: "Righteous", sans-serif; 
    font-weight: 600; 
    font-size: 2.8em; 
    margin: 0; 
    padding: 0; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    line-height: 1; 
}

/* For admin dashboard logout button */
#export-button-container { /* Renamed from previous for clarity */
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 30px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 50px; /* Added margin for bottom clearance */
}

h2 {
    font-size: 1.8em;
    color: #34495e; 
    margin-top: 30px;
    margin-bottom: 20px;
    border-bottom: 2px solid #ecf0f1; 
    padding-bottom: 10px;
}

hr {
    border: 0;
    height: 1px;
    background: #ecf0f1;
    margin: 40px 0;
}

/* --- Personal Info Fields Layout --- */
.personal-info-fields {
    display: flex;
    flex-wrap: wrap; /* Allows wrapping on smaller screens */
    gap: 20px; /* Space between fields */
    margin-bottom: 20px; /* Space below this section */
}

.personal-info-fields .form-group {
    flex: 1 1 calc(33.333% - 14px); /* 33.333% width minus gap compensation */
    min-width: 250px; /* Ensure fields don't get too narrow before wrapping */
    margin-bottom: 0; /* Remove default margin-bottom from form-group */
}
/* --- End Personal Info Fields Layout --- */


/* Form Group Styling (General) */
.form-group {
    margin-bottom: 15px; /* Default margin for form groups */
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="password"], /* Added for admin login */
.form-group select,
.form-group textarea { /* Added for admin notes */
    width: 100%;
    padding: 8px 10px; 
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 0.95em; 
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #279d9e; 
    box-shadow: 0 0 5px rgba(39, 157, 158, 0.5); 
    outline: none;
}

/* Add Buttons Container */
.add-buttons-container {
    margin-bottom: 25px;
    display: flex;
    gap: 15px; 
    justify-content: flex-start;
    align-items: center;
}

/* General Button Styles */
.btn {
    padding: 10px 20px;
    font-size: 1em;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

button {
    padding: 10px 20px;
    font-size: 1em;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.btn-primary {
    background-color: #279d9e; 
}

.btn-primary:hover {
    background-color: #1e7a7b; 
}

.btn-secondary { /* Style for Add Single Card button */
    background-color: #5cb85c; /* Standard green */
}

.btn-secondary:hover {
    background-color: #4cae4c; 
}

.btn-danger {
    background-color: #e74c3c;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-warning {
    background-color: #f39c12;
}
.btn-warning:hover {
    background-color: #e67e22;
}

.submit-btn { /* Specific style for form submit buttons */
    background-color: #279d9e; 
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    margin-top: 30px;
    width: 100%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.submit-btn:hover {
    background-color: #1e7a7b; 
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}


/* Card Entry Row Styling */
.card-entry-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px; 
    margin-bottom: 15px; 
    align-items: center; 
    border: 1px solid #e0e0e0;
    padding: 8px 15px; 
    border-radius: 8px;
    background-color: #fcfcfc;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
    position: relative;
}

.card-entry-row .form-group {
    margin-bottom: 0; 
    flex: 1;
    min-width: 140px; 
}

.card-name-group {
    flex-grow: 3;
    min-width: 250px; 
}

.card-quantity-group, .card-condition-group {
    flex-grow: 1;
    min-width: 100px;
}

/* Autocomplete Suggestions Styling */
.suggestions-container {
    position: absolute;
    background-color: white;
    border: 1px solid #ddd;
    max-height: 220px;
    overflow-y: auto;
    z-index: 1000;
    width: 100%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: none;
    left: 0;
    /* top/bottom will be set by JS dynamically */
}

.suggestions-container ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.suggestions-container li {
    padding: 8px 15px; 
    cursor: pointer;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    font-size: 0.9em;
    color: #333;
}

.suggestions-container li:last-child {
    border-bottom: none;
}

.suggestions-container li:hover {
    background-color: #e9f5ff; 
    color: #007bff;
}

.suggestions-container img {
    width: 35px; 
    height: auto;
    margin-right: 8px; 
    border-radius: 3px; 
}

/* Remove Card Button */
.remove-card-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #e74c3c; 
    font-size: 2em; /* Made bigger */
    padding: 0 5px; 
    margin-left: 10px; 
    margin-top: 2px; /* Small adjustment to bring it down slightly */
    align-self: center; 
    line-height: 1; 
    transition: color 0.2s ease, transform 0.2s ease;
}

.remove-card-btn:hover {
    color: #c0392b; 
    transform: scale(1.1);
}

.remove-icon::before {
    content: "\00D7";
    display: block; 
}

/* Status Message */
#status-message {
    margin-top: 25px;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
}

#status-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#status-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Flask Flash messages */
.flash-message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
}

.flash-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* --- Admin Dashboard Specific Styles --- */
/* For the logout button in header */
.logout-btn {
    background-color: #ffffff;
    color: #279D9E;
    padding: 8px 15px;
    border: 1px solid #279D9E;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease, color 0.3s ease;
    width: auto;
    font-weight: bold;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
}
.logout-btn:hover {
    background-color: #279D9E;
    color: #ffffff;
}

/* Table Styles for Dashboard */
.items-container { /* General wrapper for tables for consistent spacing */
    margin-top: 20px;
    overflow-x: auto; /* Enable horizontal scrolling on small screens */
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 15px; 
    background-color: #fff;
    box-shadow: 0 1px 5px rgba(0,0,0,0.08);
    border-radius: 8px;
    overflow: hidden; /* Ensures rounded corners apply to content */
}

th, td { 
    border: 1px solid #e0e0e0; 
    padding: 12px 15px; 
    text-align: left; 
    vertical-align: top; /* Align content to top for longer entries */
}

th { 
    background-color: #f8f8f8; 
    font-weight: bold; 
    color: #555;
    white-space: nowrap; /* Prevent headers from wrapping too much */
}

tr:nth-child(even) {
    background-color: #f9f9f9; /* Zebra striping */
}

tr:hover {
    background-color: #f1f1f1; /* Hover effect for rows */
}

.card-entry {
    margin-bottom: 5px;
    padding: 3px 0;
    border-bottom: 1px dotted #e0e0e0;
    font-size: 0.9em;
    line-height: 1.3;
}

.card-entry:last-child {
    border-bottom: none;
}

.submission-actions {
    display: flex;
    flex-wrap: wrap; /* Allows buttons to wrap */
    gap: 5px;
    margin-top: 10px; /* Space above action buttons */
    justify-content: flex-start; /* Align buttons to start */
}

.submission-status-badge {
    padding: 5px 10px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.85em;
    color: white;
    white-space: nowrap;
    display: inline-block; /* Ensure it respects padding/margin */
}

.status-Sent-to-WLC { background-color: #3498db; } /* Blue */
.status-Approved { background-color: #2ecc71; } /* Green */
.status-Conditional-Pending { background-color: #f1c40f; color: #333;} /* Yellow */
.status-Denied { background-color: #e74c3c; } /* Red */
.status-Received { background-color: #8e44ad; } /* Purple */

/* For individual card checkboxes in conditional form */
.card-selection-row {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    background-color: #eef; /* Light blue background for clarity */
    padding: 5px 10px;
    border-radius: 5px;
}

.card-selection-row:nth-child(even) {
    background-color: #e3eef9;
}

.card-selection-row input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2); /* Make checkbox a bit larger */
}

.card-selection-row label {
    margin-bottom: 0; /* Remove default label margin */
    font-weight: normal; /* Normal weight for label text */
    flex-grow: 1; /* Allow label to take up space */
}

/* General form styles for submission details and conditional processing */
.submission-detail-form {
    background-color: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.submission-detail-form h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #34495e;
}

.submission-detail-form .form-group {
    margin-bottom: 15px;
}

.submission-detail-form .form-group label {
    font-weight: bold;
    margin-bottom: 5px;
}

.submission-detail-form .card-list-summary {
    max-height: 200px; /* Limit height for long lists */
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    background-color: white;
    border-radius: 5px;
    margin-top: 10px;
}

.submission-detail-form .card-list-summary .card-entry {
    border-bottom: 1px solid #f0f0f0;
}

.submission-detail-form .card-list-summary .card-entry:last-child {
    border-bottom: none;
}

/* Modal for Conditional Processing */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1001; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.5); /* Black w/ opacity */
    padding-top: 60px;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto; /* 5% from the top and centered */
    padding: 20px;
    border: 1px solid #888;
    width: 80%; /* Could be more responsive */
    max-width: 700px; /* Max width */
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    position: relative;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 15px;
    top: 10px;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-footer {
    padding-top: 20px;
    text-align: right;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    .header h1 {
        font-size: 2em; 
    }
    h2 {
        font-size: 1.5em;
    }
    #export-button-container {
        position: static; /* Remove absolute positioning */
        transform: none;
        margin-top: 10px;
        text-align: center;
    }
    .personal-info-fields {
        flex-direction: column; /* Stack fields vertically on small screens */
        gap: 15px;
    }
    .personal-info-fields .form-group {
        min-width: unset; /* Remove min-width restriction for stacking */
    }
    .add-buttons-container {
        flex-direction: column;
        align-items: stretch;
    }
    .add-btn {
        width: 100%;
        margin-bottom: 10px;
    }
    .card-entry-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px 15px; 
    }
    .card-entry-row .form-group {
        min-width: unset;
    }
    .remove-card-btn {
        align-self: flex-end; 
        margin-left: 0; 
        padding: 10px 0; 
        font-size: 2em; 
    }
    /* Table specific responsive adjustments */
    table, thead, tbody, th, td, tr { 
        display: block; /* Make table elements act as block for stacking */
    }
    thead tr { 
        position: absolute;
        top: -9999px; /* Hide table headers */
        left: -9999px;
    }
    tr { border: 1px solid #ddd; margin-bottom: 10px; } /* Add border and space between stacked rows */
    td { 
        border: none; 
        border-bottom: 1px solid #eee; 
        position: relative; 
        padding-left: 50%; /* Make space for pseudo-element labels */
        text-align: right;
    }
    td:before { 
        position: absolute;
        top: 6px;
        left: 6px;
        width: 45%; 
        padding-right: 10px; 
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
    }
    /* Label the data */
    td:nth-of-type(1):before { content: "ID:"; }
    td:nth-of-type(2):before { content: "Name:"; }
    td:nth-of-type(3):before { content: "Email:"; }
    td:nth-of-type(4):before { content: "Phone:"; }
    td:nth-of-type(5):before { content: "Cards:"; }
    td:nth-of-type(6):before { content: "Status:"; }
    td:nth-of-type(7):before { content: "Actions:"; }
    td.no-label:before { content: ""; padding-left: 0; } /* For action buttons cell */

    .submission-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .submission-actions .btn {
        width: 100%;
    }
    .modal-content {
        width: 95%;
        margin: 2% auto;
    }
}