/* --- CSS Variables for easy theme management --- */
:root {
    --primary-color: #007bff;
    --primary-color-dark: #0056b3;
    --secondary-color: #6c757d;
    --text-dark: #212529;
    --text-light: #f8f9fa;
    --bg-light: rgba(255, 255, 255, 0.85);
    --bg-alt: rgba(248, 249, 250, 0.85);
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --header-height: 80px;
}

/* General Body Styles */
body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: var(--text-dark);
    background-image: url('img/Home.jpg'); /* Set background image */
    background-size: cover; /* Cover the entire area */
    background-position: center center; /* Center the image */
    background-attachment: fixed; /* Keep image fixed when scrolling */
    background-repeat: no-repeat; /* Do not repeat the image */
    min-height: 100vh; /* Ensure body takes at least the full viewport height */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background-color: rgba(248, 249, 250, 0.25); /* Highly transparent light background */
    backdrop-filter: blur(3px); /* Minimal blur for a subtle glass effect */
    -webkit-backdrop-filter: blur(3px);
    padding: 0;
    height: var(--header-height);
    position: sticky; /* Makes header stick to the top on scroll */
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1); /* Subtle dark border for contrast */
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Style for header when user scrolls down */
.header.scrolled {
    background-color: rgba(25, 25, 25, 0.8); /* Dark, glassy background on scroll */
    box-shadow: 0 2px 5px var(--shadow-color);
    border-bottom: 1px solid transparent;
}

.header .container {
    display: flex;
    justify-content: space-between; /* Pushes logo and nav apart */
    align-items: center;
    height: 100%;
}

.logo-group {
    width: 250px;
    height: var(--header-height);
}

.main-nav a {
    color: var(--text-dark); /* Black text for light transparent header */
    text-decoration: none;
    margin-left: 25px;
    font-weight: 500;
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.4); /* Improves readability on busy backgrounds */
    transition: color 0.3s ease;
    position: relative;
}

/* Change nav link color on scroll to contrast with dark header */
.header.scrolled .main-nav a {
    color: var(--text-light);
}

.main-nav a:hover {
    color: var(--primary-color); /* A brighter blue for hover effect */
}

/* Underline effect for nav links */
.main-nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.main-nav a:hover::after {
    width: 100%;
}

/* Style for the active navigation link */
.main-nav a.active {
    color: var(--primary-color);
}

.main-nav a.active::after {
    width: 100%;
}

/* Hero Section */
.hero-section {
    background-color: rgba(0, 0, 0, 0.4); /* Darker overlay for better text contrast */
    color: var(--text-light);
    text-align: center;
    padding: 120px 0;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-section h2 {
    font-size: 2.8em;
    margin-bottom: 20px;
    font-weight: 700;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5); /* Adds depth and readability */
}

.hero-section p {
    font-size: 1.2em;
    margin-bottom: 40px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5); /* Subtler shadow for paragraph */
}

/* Button Group */
.button-group {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    justify-content: center;
    gap: 20px; /* Space between buttons */
}

.btn {
    display: inline-block;
    padding: 15px 30px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1em;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 8px var(--shadow-color); /* Subtle shadow for depth */
}

.btn:hover {
    transform: translateY(-2px); /* Slight lift on hover */
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

/* --- Differentiated Button Styles --- */
.primary-btn {
    background-color: var(--text-dark); /* Black button */
    color: var(--text-light);
    border: 2px solid var(--text-dark);
}

.primary-btn:hover {
    background-color: var(--text-dark);
    filter: brightness(0.8); /* Consistent darkening effect */
}

.secondary-btn {
    background-color: var(--secondary-color); /* Grey button */
    color: var(--text-light);
    border: 2px solid var(--secondary-color);
}

.secondary-btn:hover {
    background-color: var(--secondary-color);
    filter: brightness(0.9); /* Consistent darkening effect */
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: var(--text-light);
    border-color: var(--primary-color);
}

/* Dark Sections (for Services, Contact, etc.) */
.dark-section {
    padding: 80px 0;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.5); /* Dark overlay like the hero section */
    color: var(--text-light);
}

.dark-section h3 {
    font-size: 2em;
    margin-bottom: 20px;
    color: var(--text-light);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5); /* Match hero text shadow for readability */
}

.dark-section p {
    max-width: 800px;
    margin: 0 auto 20px auto;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5); /* Match hero text shadow */
}

.dark-section a {
    color: #90caff; /* A lighter, more vibrant blue for dark backgrounds */
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: bold;
}

.dark-section a:hover {
    color: var(--text-light);
}

.dark-section ul {
    list-style: none;
    padding: 0;
    max-width: 600px;
    margin: 40px auto; /* More vertical space for the list */
    text-align: left;
}

/* Shared list item style for dark and light sections */
.info-list-item {
    background-color: rgba(255, 255, 255, 0.1); /* Subtle transparent background for list items */
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 5px;
    border-left: 5px solid var(--primary-color);
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.info-list-item:hover {
    transform: translateX(5px);
    background-color: rgba(255, 255, 255, 0.2); /* Default hover for dark sections */
}

.fade-in-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Content Sections */
.content-section {
    padding: 80px 0;
    text-align: center;
    background-color: var(--bg-light);
    backdrop-filter: blur(10px); /* Frosted glass effect */
    -webkit-backdrop-filter: blur(10px);
    margin: 40px auto; /* Add some margin for separation from full background */
    border-radius: 8px; /* Slightly rounded corners */
    box-shadow: 0 4px 10px var(--shadow-color); /* Soft shadow */
}

/* --- Animation for sections scrolling into view --- */

.content-section h3 {
    font-size: 2em;
    margin-bottom: 20px;
    color: var(--text-dark);
}

.content-section p {
    max-width: 800px;
    margin: 0 auto 20px auto;
}

.content-section ul {
    list-style: none;
    padding: 0;
    max-width: 600px;
    margin: 20px auto;
    text-align: left;
}

/* Overrides for list items in light content sections */
.content-section .info-list-item {
    background-color: #fff;
    box-shadow: 0 2px 5px var(--shadow-color);
}

.content-section .info-list-item:hover {
    box-shadow: 0 4px 8px var(--shadow-color);
    background-color: #fff; /* Keep background white on hover */
}

.alternate-bg {
    background-color: var(--bg-alt);
}

/* Footer */
.footer {
    background-color: #212529; /* Dark grey, less harsh than pure black */
    color: #adb5bd; /* Lighter grey text */
    text-align: center;
    padding: 30px 0;
    font-size: 0.9em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        height: auto; /* Allow header to grow if content wraps */
        min-height: var(--header-height);
    }
    .header .container {
        flex-direction: column;
        align-items: center; /* Center nav items when stacked */
    }

    .main-nav {
        width: 100%;
        text-align: center;
    }

    .main-nav a {
        margin: 5px 10px; /* Add vertical margin for wrapped links */
        display: inline-block;
    }

    .hero-section h2 {
        font-size: 2.2em;
    }
}

/* --- Form Specific Styles (for both service and toner forms) --- */
.service-form, .toner-form { /* Apply these styles to both forms */
    max-width: 600px; /* A bit wider for a better look on dark bg */
    margin: 0 auto;
    padding: 0; /* Remove padding, as the section has it */
    background-color: transparent; /* Make form background transparent */
    border: none; /* Remove border */
    box-shadow: none; /* Remove shadow */
    text-align: left; /* Align form elements to the left */
}

/* Login form specific styling */
#login-form {
    max-width: 450px; /* A more compact width for a login form */
    margin: 40px auto 0; /* Add some top margin from the title */
    text-align: left;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block; /* Make labels take their own line */
    margin-bottom: 5px; /* Reduced from 8px */
    font-weight: 500;
    color: var(--text-light); /* Light text for dark background */
}

/* Use :is() to simplify the selector list for form inputs */
.form-group :is(input:not([type="submit"]), textarea, select) {
    width: 100%; /* Full width input fields */
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.1); /* Subtle light background for inputs */
    border: 1px solid rgba(255, 255, 255, 0.3); /* Light border */
    color: var(--text-light); /* Light text color for input */
    border-radius: 5px;
    font-size: 1em;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

/* Style for input placeholders on dark background */
.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
    opacity: 1; /* Override Firefox's default opacity */
}

/* Use :is() to simplify the selector list for focus styles */
.form-group :is(input:not([type="submit"]), textarea, select):focus {
    border-color: var(--primary-color); /* Highlight on focus */
    background-color: rgba(255, 255, 255, 0.2); /* Slightly lighter on focus */
    outline: none; /* Remove default outline */
}

/* Custom File Upload Button */
.custom-file-upload {
    display: flex;
    align-items: center;
    gap: 15px;
}

.custom-file-upload input[type="file"] {
    display: none; /* Hide the actual file input */
}

.custom-file-upload .btn {
    cursor: pointer;
}

.file-name-display {
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
    font-size: 0.8em; /* Ensure consistent font size with the button */
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: rgba(255, 255, 255, 0.7);
}

.form-group textarea {
    resize: vertical; /* Allow vertical resizing of textarea */
}

.service-form .btn, .toner-form .btn { /* Apply to both form buttons */
    width: auto; /* Allow button to size naturally */
    display: block; /* Make button take full width on its line */
    margin: 30px auto 0 auto; /* More top margin */
}

/* Status messages for form submissions */
.status-message {
    text-align: center;
    margin-top: 15px; /* Reduced from 20px */
    font-size: 1.1em;
    font-weight: bold;
    color: #28a745; /* A nice green for success */
}

.status-message.error {
    color: red; /* Error color */
}

/* --- New Styling for "How to get serial" button and image --- */
.input-with-button {
    display: flex;
    align-items: center; /* Vertically align items */
    gap: 10px; /* Space between input and button */
}

.input-with-button input[type="text"],
.input-with-button input[type="tel"],
.input-with-button input[type="email"],
.input-with-button input[type="password"],
.input-with-button input[type="number"] {
    flex-grow: 1; /* Allow input to take up available space */
}

/* Small button styling */
.btn.small-btn {
    padding: 12px 15px; /* Match the input field height */
    font-size: 0.8em;
    white-space: nowrap; /* Prevent text wrapping */
}

/* Info icon */
.info-icon {
    cursor: pointer;
    margin-left: 5px;
    color: var(--primary-color);
    font-weight: bold;
}

/* Info image container */
.info-image-container {
    display: none; /* Initially hidden */
    margin-top: 15px;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 5px;
    background-color: #f9f9f9;
    text-align: center;
}

.info-image-container.show {
    display: block; /* Show when 'show' class is added by JS */
}

.info-image-container .info-image {
    max-width: 100%;
    height: auto;
    display: block; /* Ensures image takes full width and no extra space */
    margin: 0 auto; /* Center image */
}

/* Loading Spinner */
.loading-spinner {
    display: none; /* Hidden by default */
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--primary-color); /* Use primary color for the spinner */
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    margin: 15px auto; /* Center it below the button */
}

.loading-spinner.show {
    display: block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Forms & Ticket Viewer --- */
#login-section .container,
#viewer-section .container {
    max-width: 1100px; /* Allow wider container for tables */
}

.table-container {
    overflow-x: auto;
    margin-bottom: 2.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    color: #f0f0f0;
    font-size: 0.95rem;
}

table th, table td {
    padding: 1rem 1.25rem;
    text-align: left;
}

.btn-close {
    background-color: #c0392b;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-close:hover {
    background-color: #e74c3c;
}

.viewer-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.viewer-header-controls h3 {
    margin: 0;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto; /* Pushes the filter to the left of the logout button */
    margin-right: 1.5rem;
}

.filter-controls label {
    font-weight: 500;
    color: var(--text-light);
}

.filter-controls select {
    padding: 8px 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-light);
    border-radius: 5px;
    font-size: 0.9em;
}

.filter-controls select option {
    background-color: #333;
    color: var(--text-light);
}

.issue-cell {
    white-space: normal; /* Allow long issue descriptions to wrap */
    min-width: 250px;
    max-width: 400px;
}

.attachment-link {
    color: #90caff; /* A lighter, more vibrant blue for dark backgrounds */
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.attachment-link:hover {
    color: var(--text-light);
    text-decoration: underline;
}

/* --- Responsive Table (Card View on Mobile) --- */
@media (max-width: 992px) {
    table thead {
        display: none; /* Hide table headers */
    }

    table, table tbody, table tr, table td {
        display: block; /* Make table elements behave like blocks */
        width: 100%;
    }

    table tr {
        margin-bottom: 1.5rem;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 5px;
        background-color: rgba(255, 255, 255, 0.05);
    }

    table td {
        text-align: right; /* Align cell content to the right */
        position: relative;
        padding-left: 50%; /* Create space for the label */
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    table td:last-child {
        border-bottom: none;
    }

    /* Use data-label attribute (set in JS) to show headers */
    table td::before {
        content: attr(data-label);
        position: absolute;
        left: 1.25rem;
        font-weight: bold;
        text-align: left;
        white-space: nowrap;
    }

    .issue-cell {
        min-width: unset;
        max-width: unset;
    }
}