/* Products Module Styles */

/* Container */
.products-container,
.product-form-container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.products-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #E0E0E0;
}

.products-header h2 {
    color: #31566D;
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.products-header .text-muted {
    color: #78909C;
    font-size: 14px;
    margin: 0;
}

.products-header .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #c91d2b 0%, #a01621 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.products-header .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(201, 29, 43, 0.3);
}

/* Filters */
.products-filters {
    margin-bottom: 24px;
}

.search-box {
    position: relative;
    max-width: 400px;
}

.search-box svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #78909C;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 44px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #c91d2b;
    box-shadow: 0 0 0 3px rgba(201, 29, 43, 0.1);
}

/* Products Table */
.products-table-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.products-table {
    width: 100%;
    border-collapse: collapse;
}

.products-table thead {
    background: #F5F5F5;
}

.products-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: #31566D;
    font-size: 14px;
    border-bottom: 2px solid #E0E0E0;
}

.products-table tbody tr {
    border-bottom: 1px solid #F0F0F0;
    transition: background 0.2s ease;
}

.products-table tbody tr:hover {
    background: #F9F9F9;
}

.products-table td {
    padding: 16px;
    vertical-align: middle;
    font-size: 14px;
    color: #424242;
}

/* Product Image */
.product-image,
.product-image-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
}

.product-image-placeholder {
    background: #F5F5F5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9E9E9E;
}

/* Product Name */
.product-name {
    font-weight: 500;
    color: #31566D;
}

.product-subtitle {
    font-size: 12px;
    color: #78909C;
    margin-top: 4px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-discount {
    background: #E8F5E9;
    color: #2E7D32;
}

/* Price */
.price-discounted {
    color: #2E7D32;
    font-weight: 600;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #F5F5F5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-edit {
    color: #1976D2;
}

.btn-edit:hover {
    background: #E3F2FD;
}

.btn-delete {
    color: #D32F2F;
}

.btn-delete:hover {
    background: #FFEBEE;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    color: #9E9E9E;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: #31566D;
    font-size: 24px;
    margin: 0 0 8px 0;
}

.empty-state p {
    color: #78909C;
    margin: 0 0 24px 0;
}

/* Product Form */
.form-header {
    margin-bottom: 30px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #78909C;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 16px;
    transition: color 0.2s ease;
}

.btn-back:hover {
    color: #31566D;
}

.form-header h2 {
    color: #31566D;
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.product-form {
    max-width: 900px;
}

.form-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card-title {
    color: #31566D;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #F0F0F0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #31566D;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group label.required::after {
    content: " *";
    color: #D32F2F;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: #c91d2b;
    box-shadow: 0 0 0 3px rgba(201, 29, 43, 0.1);
}

.form-control::placeholder {
    color: #BDBDBD;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-text {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #78909C;
}

.text-danger {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #D32F2F;
}

/* Price Preview */
.price-preview {
    background: #F5F5F5;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}

.preview-item span {
    color: #78909C;
}

.preview-item strong {
    color: #31566D;
    font-size: 16px;
}

.text-success {
    color: #2E7D32 !important;
}

.text-primary {
    color: #c91d2b !important;
    font-size: 18px !important;
}

/* Image Upload Widget */
.image-upload-group {
    margin-bottom: 24px;
}

.image-upload-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-top: 8px;
}

.image-preview {
    flex-shrink: 0;
    width: 140px;
    height: 140px;
    border-radius: 10px;
    border: 2px dashed #E0E0E0;
    overflow: hidden;
    background: #F9F9F9;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease;
}

.image-preview:hover {
    border-color: #c91d2b;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.upload-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
}

.upload-controls input[type="file"] {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
}

.upload-controls .text-muted {
    font-size: 12px;
    color: #78909C;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #c91d2b 0%, #a01621 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(201, 29, 43, 0.3);
}

.btn-secondary {
    background: #F5F5F5;
    color: #424242;
}

.btn-secondary:hover {
    background: #E0E0E0;
}

.btn-danger {
    background: #D32F2F;
    color: white;
}

.btn-danger:hover {
    background: #C62828;
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #A5D6A7;
}

.alert-error {
    background: #FFEBEE;
    color: #C62828;
    border: 1px solid #EF9A9A;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #E0E0E0;
}

.modal-header h3 {
    color: #31566D;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: #F5F5F5;
    border: none;
    color: #c91d2b;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #FFEBEE;
    color: #A01621;
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    margin: 0 0 12px 0;
    color: #424242;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid #E0E0E0;
}

/* Responsive */
@media (max-width: 768px) {
    .products-header {
        flex-direction: column;
        gap: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .products-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .products-table {
        min-width: 800px;
    }

    .image-upload-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .image-preview {
        width: 100%;
        height: 180px;
    }
}