/* Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Semi+Condensed:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

:root {
    --primary-color: #003366;
    /* Professional Blue */
    --secondary-color: #f4f7f6;
    /* Light Grey Background */
    --accent-color: #2c3e50;
    /* Dark Slate */
    --text-color: #333333;
    --border-color: #e0e0e0;
    --success-color: #27ae60;
    --error-color: #c0392b;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    --primary-red: #DC3545;
    --secondary-gold: #B0B193;
    --dark-gray: #2C2C2C;
    --light-gray: #F5F5F5;
    --font-main: 'Barlow Semi Condensed', sans-serif;
}

body {
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    background-color: var(--light-gray);
    color: var(--dark-gray);
    line-height: 1.6;
}

h1,
h2,
h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.3s;
}

a:hover {
    color: var(--accent-color);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-box {
    background: var(--white);
    padding: 40px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box h2 {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

/* Cart Functionality Styles */

/* Quantity Input - Compact Style */
.qty-input {
    width: 50px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.2s ease;
    background: white;
}

.qty-input:focus {
    border-color: var(--primary-red);
    outline: none;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1);
}

.qty-input:hover {
    border-color: #aaa;
}

/* Add to Cart Button - Compact Style */
.add-to-cart-btn {
    background: var(--primary-red);
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.add-to-cart-btn:hover:not(:disabled) {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.25);
}

.add-to-cart-btn:active:not(:disabled) {
    transform: translateY(0);
}

.add-to-cart-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Cart Badge in Header */
.cart-badge {
    position: relative;
    display: inline-block;
    margin-left: 15px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.cart-badge:hover {
    transform: scale(1.05);
}

.cart-badge .cart-icon {
    font-size: 1.5em;
    color: var(--dark-gray);
    transition: color 0.2s;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.cart-badge:hover .cart-icon {
    color: var(--primary-red);
}

.cart-badge .badge-count {
    position: absolute;
    top: -6px;
    right: -10px;
    background: var(--primary-red);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.65em;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(220, 53, 69, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.cart-badge .badge-count.hidden {
    display: none;
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    border-left: 3px solid var(--success-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    padding: 12px 16px;
    min-width: 280px;
    max-width: 380px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    backdrop-filter: blur(10px);
}

.toast.error {
    border-left-color: var(--error-color);
}

.toast.warning {
    border-left-color: #f39c12;
}

.toast.info {
    border-left-color: #3498db;
}

.toast-icon {
    font-size: 1.3em;
    flex-shrink: 0;
    line-height: 1;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--error-color);
}

.toast.warning .toast-icon {
    color: #f39c12;
}

.toast.info .toast-icon {
    color: #3498db;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--dark-gray);
    font-size: 0.9em;
}

.toast-message {
    font-size: 0.85em;
    color: #666;
    line-height: 1.3;
}

.toast-close {
    cursor: pointer;
    color: #999;
    font-size: 1.2em;
    line-height: 1;
    padding: 0 4px;
    transition: all 0.2s;
    font-weight: 300;
}

.toast-close:hover {
    color: var(--dark-gray);
    transform: rotate(90deg);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.removing {
    animation: slideOut 0.25s ease-in forwards;
}

/* Actions Column in Catalog - Clean Layout */
.actions-cell {
    text-align: center;
    white-space: nowrap;
    padding: 15px 10px !important;
    vertical-align: middle;
}

.actions-cell .qty-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Availability Checkbox Filter */
#availabilityFilter {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-red);
}

#availabilityFilter:hover {
    transform: scale(1.1);
}

/* Cart Confirmation Modal */
.cart-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.cart-modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cart-modal-header {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    padding: 25px;
    border-radius: 12px 12px 0 0;
    text-align: center;
}

.cart-modal-icon {
    display: inline-block;
    width: 60px;
    height: 60px;
    background: white;
    color: #27ae60;
    border-radius: 50%;
    font-size: 2.5em;
    line-height: 60px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cart-modal-header h3 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
}

.cart-modal-body {
    padding: 25px;
    text-align: center;
}

.cart-modal-product {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
}

.cart-modal-product img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
}

.cart-modal-product-info {
    flex: 1;
    text-align: left;
}

.cart-modal-product-info h4 {
    margin: 0 0 5px 0;
    font-size: 1em;
    color: var(--dark-gray);
}

.cart-modal-product-info p {
    margin: 0;
    font-size: 0.85em;
    color: #666;
}

.cart-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 15px;
}

.cart-modal-footer .btn {
    margin: 0;
    padding: 12px 20px;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 16px;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* Button Styles */
.btn {
    background-color: var(--primary-red);
    color: white;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    font-size: 1em;
    border-radius: 4px;
    transition: background 0.3s;
    text-decoration: none;
    display: inline-block;
    width: 100%;
}

.btn:hover {
    background-color: #c82333;
    color: white;
    /* Darker shade of primary red */
}

/* Secondary Button (Grey) */
.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
    color: white;
}

.alert {
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 4px;
    text-align: left;
}

.alert-danger {
    background-color: #fce4e4;
    color: var(--error-color);
    border: 1px solid #fcc2c3;
}

.catalog-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    box-shadow: var(--shadow);
    margin-top: 20px;
}

.catalog-table th,
.catalog-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.catalog-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: var(--text-color);
}

.catalog-table tr:hover {
    background-color: #f1f1f1;
}

.product-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
}

.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    color: var(--white);
}

.badge-available {
    background-color: var(--success-color);
}

.badge-out {
    background-color: var(--error-color);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    list-style: none;
    padding: 0;
}

.pagination li {
    margin: 0 5px;
}

.pagination a {
    display: block;
    padding: 8px 12px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
}

.pagination a.active,
.pagination a:hover {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* Filters */
.filter-row th {
    padding: 10px;
    background: #e9ecef;
    font-size: 0.85em;
    /* Reduced header font */
}

.filter-input {
    width: 90%;
    padding: 4px;
    /* Reduced padding */
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9em;
    /* Reduced input font */
}

/* Multi-select Dropdown */
.dropdown-check-list {
    display: inline-block;
    position: relative;
    width: 90%;
}

.dropdown-check-list .anchor {
    position: relative;
    cursor: pointer;
    display: inline-block;
    padding: 5px 50px 5px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-check-list .anchor:after {
    position: absolute;
    content: "";
    border-left: 2px solid black;
    border-top: 2px solid black;
    padding: 5px;
    right: 10px;
    top: 20%;
    -moz-transform: rotate(-135deg);
    -ms-transform: rotate(-135deg);
    -o-transform: rotate(-135deg);
    -webkit-transform: rotate(-135deg);
    transform: rotate(-135deg);
}

.dropdown-check-list .anchor:active:after {
    right: 8px;
    top: 21%;
}

.dropdown-check-list ul.items {
    padding: 2px;
    display: none;
    margin: 0;
    border: 1px solid #ccc;
    border-top: none;
    position: absolute;
    background: #fff;
    z-index: 1000;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
}

.dropdown-check-list ul.items li {
    list-style: none;
    border-bottom: 1px solid #eee;
}

.dropdown-check-list ul.items li:last-child {
    border-bottom: none;
}

.dropdown-check-list.visible .anchor {
    color: #0094ff;
}

.dropdown-check-list.visible .items {
    display: block;
}

.item-label {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    cursor: pointer;
}

.item-label:hover {
    background-color: #f1f1f1;
}

.item-label input {
    margin-right: 10px;
}

/* Specific Column Styles */
.col-code {
    width: 12%;
    font-size: 0.85em;
    /* Code & Image */
}

.catalog-table th:nth-child(2),
.catalog-table td:nth-child(2) {
    /* Description - Auto width */
}

.catalog-table th:nth-child(3),
.catalog-table td:nth-child(3) {
    width: 10%;
    /* Color */
}

.catalog-table th:nth-child(4),
.catalog-table td:nth-child(4) {
    width: 8%;
    /* Size */
}

.catalog-table th:nth-child(5),
.catalog-table td:nth-child(5) {
    width: 15%;
    /* Price */
}

.catalog-table th:nth-child(6),
.catalog-table td:nth-child(6) {
    width: 10%;
    /* Availability */
}

/* Image Modal (Lightbox) */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(0, 0, 0);
    background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 1000px;
    /* Target 1000px as requested or max fitting */
    max-height: 90vh;
    object-fit: contain;
}

.modal-content,
#caption {
    -webkit-animation-name: zoom;
    -webkit-animation-duration: 0.6s;
    animation-name: zoom;
    animation-duration: 0.6s;
}

@-webkit-keyframes zoom {
    from {
        -webkit-transform: scale(0)
    }

    to {
        -webkit-transform: scale(1)
    }
}

@keyframes zoom {
    from {
        transform: scale(0)
    }

    to {
        transform: scale(1)
    }
}

.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}