* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1 {
    color: #333;
    margin-bottom: 30px;
    text-align: center;
}

h2 {
    color: #555;
    margin-bottom: 20px;
}

.form-container {
    margin-bottom: 40px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

/* New Two-Column Form Layout */
.form-layout {
    display: grid;
    grid-template-columns: 300px 650px;
    gap: 30px;
    margin-bottom: 20px;
}

.form-left-column {
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    min-height: 400px;
}

.form-right-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.existing-images-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.existing-images-vertical > div {
    width: 100%;
}

.existing-images-vertical img {
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: contain;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}

.existing-images-vertical img:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Field Groups (PRICES and SALES boxes) */
.field-group {
    background-color: #fff;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    padding: 20px;
    margin-top: 10px;
}

.group-title {
    font-size: 16px;
    font-weight: 700;
    color: #4CAF50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #4CAF50;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-weight: 600;
    color: #555;
    min-width: 150px;
    flex-shrink: 0;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="file"],
select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    flex: 1;
}

input:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

input:focus,
select:focus {
    outline: none;
    border-color: #4CAF50;
}

.form-actions {
    display: flex;
    gap: 10px;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.3s;
}

#submit-btn {
    background-color: #4CAF50;
    color: white;
}

#submit-btn:hover {
    background-color: #45a049;
}

#cancel-btn {
    background-color: #999;
    color: white;
}

#cancel-btn:hover {
    background-color: #777;
}

.table-container {
    margin-top: 30px;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background-color: #4CAF50;
    color: white;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    font-weight: 600;
    white-space: nowrap;
}

tbody tr:hover {
    background-color: #f5f5f5;
}

.action-btn {
    padding: 6px 12px;
    margin-right: 5px;
    font-size: 12px;
}

.edit-btn {
    background-color: #2196F3;
    color: white;
}

.edit-btn:hover {
    background-color: #0b7dda;
}

.delete-btn {
    background-color: #f44336;
    color: white;
}

.delete-btn:hover {
    background-color: #da190b;
}

#sales-tbody tr {
    transition: background-color 0.2s;
}

/* Table action buttons with icons */
table td button {
    padding: 6px 10px;
    margin: 2px;
    font-size: 16px;
    min-width: 36px;
    border-radius: 4px;
}

table td button:first-child {
    background-color: #2196F3;
    color: white;
}

table td button:first-child:hover {
    background-color: #0b7dda;
}

table td button:last-child {
    background-color: #f44336;
    color: white;
}

table td button:last-child:hover {
    background-color: #da190b;
}

/* Image preview styles */
.image-preview {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.existing-images {
    margin-top: 15px;
    padding: 15px;
    background-color: #fff;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.existing-images h3 {
    color: #555;
    font-size: 16px;
    margin-bottom: 10px;
}

input[type="file"] {
    display: none;
}

/* Drop zone styles */
.drop-zone {
    border: 2px dashed #4CAF50;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f9f9f9;
    margin-top: 10px;
}

.drop-zone:hover {
    background-color: #e8f5e9;
    border-color: #45a049;
}

.drop-zone.dragover {
    background-color: #c8e6c9;
    border-color: #2e7d32;
    transform: scale(1.02);
}

.drop-zone p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

@media (max-width: 768px) {
    .form-layout {
        grid-template-columns: 1fr;
    }
    
    .form-left-column {
        min-height: auto;
    }
    
    .existing-images-vertical img {
        max-height: 200px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 15px;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 8px;
    }
}

/* Image Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.95);
}

.modal-image-container {
    position: relative;
    overflow: auto;
    max-width: 90%;
    max-height: 80vh;
    margin: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
}

.modal-image-container:active {
    cursor: grabbing;
}

.modal-content {
    display: block;
    transition: transform 0.2s ease;
    transform-origin: center center;
    user-select: none;
    max-width: none;
    height: auto;
}

@keyframes zoom {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 10000;
}

.modal-close:hover,
.modal-close:focus {
    color: #bbb;
}

.modal-prev,
.modal-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    padding: 16px;
    color: white;
    font-weight: bold;
    font-size: 30px;
    transition: 0.3s;
    border: none;
    background-color: rgba(0, 0, 0, 0.5);
    user-select: none;
    z-index: 10000;
}

.modal-prev {
    left: 0;
    border-radius: 0 3px 3px 0;
}

.modal-next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.modal-prev:hover,
.modal-next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    font-size: 16px;
}

.modal-counter {
    text-align: center;
    color: #ccc;
    padding: 5px 0;
    font-size: 14px;
}

.modal-zoom-controls {
    position: absolute;
    top: 20px;
    right: 70px;
    display: flex;
    gap: 10px;
    z-index: 1001;
}

.modal-zoom-in,
.modal-zoom-out,
.modal-zoom-reset {
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-weight: bold;
}

.modal-zoom-in:hover,
.modal-zoom-out:hover,
.modal-zoom-reset:hover {
    background-color: rgba(76, 175, 80, 0.8);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
    }
    
    .modal-close {
        top: 10px;
        right: 15px;
        font-size: 35px;
    }
    
    .modal-prev,
    .modal-next {
        font-size: 20px;
        padding: 10px;
    }
}
