/* General Body Styles */
body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

/* Container for main content to center it and give it a max-width */
main {
    max-width: 960px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

/* Header Styles */
header {
    background-color: #007bff;
    color: #fff;
    padding: 20px 0;
    text-align: center;
    margin-bottom: 20px;
    border-radius: 8px 8px 0 0;
}

header h1 {
    margin: 0;
    font-size: 2.5em;
}

header p {
    font-size: 1.2em;
}

/* Section Styles (for Store Info and Products) */
section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #fcfcfc;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.05); /* Lighter shadow for sections */
}

section h2 {
    color: #007bff;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 20px;
}

/* Footer Styles */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    color: #777;
    font-size: 0.9em;
}

/* Basic Product Grid for Public Display */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 15px; /* Add padding to the grid container */
}

/* Product Item Styling (for public display) */
.product-item {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease-in-out;
}

.product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.product-item img {
    max-width: 100%;
    height: 180px; /* Fixed height for consistency */
    object-fit: cover; /* Ensures image covers area without distortion */
    border-radius: 4px;
    margin-bottom: 10px;
}

.product-item h3 {
    color: #333;
    font-size: 1.3em;
    margin-top: 10px;
    margin-bottom: 5px;
}

.product-item p {
    font-size: 0.95em;
    color: #666;
    margin-bottom: 10px;
}

.product-item .price {
    font-size: 1.4em;
    color: #28a745;
    font-weight: bold;
    margin-top: 10px;
    margin-bottom: 15px;
}

.product-item button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

.product-item button:hover {
    background-color: #0056b3;
}


/* General form styling for new data forms */
.data-form {
    max-width: 600px;
    margin: 0 auto 30px auto;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fcfcfc;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.data-form .form-group {
    margin-bottom: 15px;
}

.data-form .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.data-form input[type="text"],
.data-form input[type="email"],
.data-form input[type="number"],
.data-form input[type="url"],
.data-form textarea,
.data-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
}

.data-form textarea {
    resize: vertical;
}

.data-form button[type="submit"],
.data-form button[type="button"] {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.2s ease;
    width: auto;
    display: inline-block;
    margin-top: 20px;
}

.data-form button[type="submit"]:hover {
    background-color: #0056b3;
}
.data-form button[type="button"]:hover {
    background-color: #5a6268;
}


/* Table styling */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

table th, table td {
    padding: 12px 15px;
    border: 1px solid #ddd;
    text-align: left;
}

table th {
    background-color: #e9ecef;
    color: #333;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
}

table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

table tbody tr:hover {
    background-color: #e2f2ff;
}

/* Specific styles for ticket status and priority */
.status-open { color: #007bff; font-weight: bold; }
.status-in-progress { color: #ffc107; font-weight: bold; }
.status-closed { color: #28a745; font-weight: bold; }

.priority-low { color: #28a745; }
.priority-medium { color: #ffc107; }
.priority-high { color: #dc3545; font-weight: bold; }

/* Table action buttons */
.table-actions button {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    margin-right: 5px;
    transition: background-color 0.2s ease;
}

.table-actions button.update-btn {
    background-color: #17a2b8;
}
.table-actions button.update-btn:hover {
    background-color: #138496;
}

.table-actions button.delete-btn {
    background-color: #dc3545;
}
.table-actions button.delete-btn:hover {
    background-color: #c82333;
}

/* Styling for Ticket Filters */
.ticket-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fcfcfc;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    align-items: flex-end;
}

.ticket-filters .form-group {
    flex: 1;
    min-width: 180px;
    margin-bottom: 0;
}

.ticket-filters label {
    margin-bottom: 5px;
    font-weight: bold;
    display: block;
    color: #555;
}

.ticket-filters input[type="text"],
.ticket-filters select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 0.95em;
}

.ticket-filters button {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background-color 0.2s ease;
    align-self: flex-end;
}

.ticket-filters button#apply_ticket_filters {
    background-color: #007bff;
}
.ticket-filters button#apply_ticket_filters:hover {
    background-color: #0056b3;
}

.ticket-filters button#reset_ticket_filters {
    background-color: #dc3545;
}
.ticket-filters button#reset_ticket_filters:hover {
    background-color: #c82333;
}

/* Styles for form messages */
.form-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    display: none;
}

.form-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Basic Loading Spinner */
.loading-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #007bff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-left: 10px;
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ensure buttons don't have loading spinner unless explicitly added */
.data-form button[type="submit"],
.data-form button[type="button"] {
    position: relative;
    padding-right: 40px; /* Make space for spinner */
}

.data-form button[type="submit"] .loading-spinner,
.data-form button[type="button"] .loading-spinner {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

/* --- DASHBOARD/REPORTS --- */
#dashboard-reports {
    text-align: center;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.report-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.report-card.full-width {
    grid-column: 1 / -1;
    text-align: left;
}

.report-card h3 {
    color: #007bff;
    font-size: 1.3em;
    margin-top: 0;
    margin-bottom: 10px;
}

.report-value {
    font-size: 2.5em;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.report-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.report-list li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.95em;
    color: #555;
}

.report-list li:last-child {
    border-bottom: none;
}

.report-list li strong {
    color: #333;
}