/* ===========================================
   CLEAN & ORGANIZED CSS
   ===========================================
   Table of Contents:
   1. Reset & General
   2. Typography
   3. Layout & Containers
   4. Navigation
   5. Welcome Section
   6. Features Section
   7. Forms & Inputs
   8. Buttons
   9. Tables
   10. Modals
   11. Messages
   12. Product Grid & Cards
   13. Size & Dimensions
   14. Colors
   15. Export & Misc
   16. Pagination & Sorting
   =========================================== */

/* ===== 1. RESET & GENERAL ===== */
body { 
    font-family: poppins, sans-serif; 
    margin: 0;
    padding: 0;
    background: url('../img/tlo.webp') no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(54, 54, 54, 0.1);
    z-index: -1;
}

/* ===== 2. TYPOGRAPHY ===== */
h1 {
    color: #f8f8f8;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.description-title {
    font-weight: bold;
    margin-bottom: 5px;
}

/* ===== 3. LAYOUT & CONTAINERS ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.icon-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.btn-text {
    margin-left: 6px;
    white-space: nowrap;
}

.actions {
    display: flex;
    gap: 5px;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.no-wymiary-info {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 10px;
    margin: 0;
    background-color: white;
    border-radius: 4px;
    border: 1px dashed #ddd;
}

.edit-layout {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}

.edit-column {
    flex: 1;
    min-width: 0;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row-spaced {
    display: flex;
    gap: 30px;
}

.buttons-container {
    text-align: right;
    margin-top: 20px;
}

/* ===== 4. NAVIGATION ===== */
nav {
    background: rgba(1, 6, 12, 0.9);
    padding: 0;
    position: relative;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    overflow: hidden;
    background-color: #333;
}

nav li {
    float: left;
    margin-right: 0;
}

nav a {
    display: block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    font-weight: bold;
    transition: background 0.3s;
}

nav a:hover {
    background-color: #111;
}

/* ===== 5. WELCOME SECTION ===== */
.welcome {
    background: rgba(255, 255, 255, 0.85);
    padding: 30px;
    border-radius: 10px;
    max-width: 800px;
    margin: 50px auto;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.welcome p {
    font-size: 1.3em;
    color: #444;
    margin-bottom: 20px;
}

/* ===== 6. FEATURES SECTION ===== */
.features {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 50px;
}

.feature {
    background: rgba(255, 255, 255, 0.9);
    padding: 25px;
    border-radius: 8px;
    width: 250px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.feature:hover {
    transform: translateY(-5px);
}

.feature h3 {
    color: #1d2329;
    margin-top: 0;
}

/* ===== 7. FORMS & INPUTS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group.half {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="text"],
input[type="file"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
}

textarea {
    height: 100px;
}

/* ===== 8. BUTTONS ===== */
button {
    background-color: #4CAF50;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
}

button:hover {
    background-color: #45a049;
}

.btn {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s;
}

/* Basic button styles */
.btn-edit {
    background-color: #4caf50;
    color: white;
}

.btn-edit:hover {
    background-color: #45a049;
}


.btn-add {
    background-color: #4CAF50;
    color: white;
}

.btn-add:hover {
    background-color: #45a049;
}

#add-color-btn {
    background: #337ab7;
    margin-bottom: 15px;
}

/* Icon buttons */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-icon:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.btn-icon img, 
.action-icon {
    width: 24px;
    height: 24px;
}

.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

.btn-download {
    display: inline-block;
    padding: 0;
    background: none;
    border: none;
}

.btn-download:hover img {
    opacity: 0.8;
}

.btn-export {
    padding: 10px 15px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
    display: inline-flex;
    align-items: center;
}

.btn-export:hover {
    background: #218838;
}

.btn-export img {
    margin-right: 5px;
}

.preview-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.preview-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.remove-color {
    background: #ffffff;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    padding: 8px;
}

/* ===== 9. TABLES ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

th {
    background-color: #f2f2f2;
}

/* Wymiary table */
.wymiary-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    font-size: 14px;
}

.wymiary-table th,
.wymiary-table td {
    padding: 0px 0px;
    text-align: left;
    border: 1px solid #ddd;
}

.wymiary-table th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.wymiary-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.wymiary-table tr:hover {
    background-color: #f1f1f1;
}

/* ===== 10. MODALS ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-top: 0;
    color: #333;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #333;
}

/* ===== 11. MESSAGES ===== */
.message {
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    font-weight: bold;
}

.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== 12. PRODUCT GRID & CARDS ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.product-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    background: white;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.product-image-container {
    height: 400px;
    width: 300px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
    margin: 0 auto;
}

.product-image {
    max-width: 300px;
    max-height: 400px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #888;
    font-style: italic;
}

.product-details {
    padding: 15px;
}

.product-title {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 18px;
    color: #333;
}

.product-info {
    margin: 5px 0;
    font-size: 14px;
    color: #555;
}

.product-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

.product-description {
    display: none;
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
}

.product-description.active {
    display: block;
}

.edit-image-preview {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    background-color: #f9f9f9;
}

#current-image-container {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 6px;
    border: 1px dashed #ddd;
}

#current-image-container p {
    margin-top: 0;
    font-weight: bold;
    color: #555;
}

.edit-image-preview {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 4px;
    margin: 10px 0;
}

/* ===== 13. SIZE & DIMENSIONS ===== */
.size-section {
    margin-top: 20px;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.size-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.dimensions-container {
    margin-left: 20px;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
}

.dimension-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.wymiar-input-group {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 5px;
    border-bottom: 1px solid #eee;
}

.wymiar-input-group label {
    display: flex;
    align-items: center;
    margin-right: 15px;
    min-width: 150px;
}

.wymiar-checkbox {
    margin-right: 8px;
    cursor: pointer;
}

.wymiar-value {
    width: 80px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.wymiar-value:disabled {
    background-color: #f5f5f5;
}

#wymiary-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 4px;
}

.wymiary-edit-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    max-height: 200px;
    overflow-y: auto;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #ddd;
    margin-top: 10px;
}

.wymiar-edit-row {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: white;
    border-radius: 4px;
    border: 1px solid #eee;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.wymiar-nazwa {
    flex: 1;
    font-size: 14px;
    margin-right: 10px;
}

/* ===== 14. COLORS ===== */
.color-container {
    margin-top: 10px;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #eee;
}

.color-row select {
    flex: 2;
}

.color-row input[type="text"] {
    flex: 2;
}

/* ===== 15. EXPORT & MISC ===== */
.export-buttons {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.file-type {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ===== 16. PAGINATION & SORTING ===== */
/* Pagination container */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    padding: 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Pagination list */
.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
}

.pagination li {
    margin: 0 5px;
}

.pagination a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: #f5f5f5;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s;
}

.pagination a:hover {
    background-color: #e0e0e0;
}

.pagination a.active {
    background-color: #4CAF50;
    color: white;
    cursor: default;
}

.pagination a.disabled {
    color: #aaa;
    cursor: not-allowed;
}

.pagination li span {
    display: inline-block;
    padding: 8px;
}

/* Per page selector */
.per-page-container {
    display: flex;
    align-items: center;
}

.per-page-label {
    margin-right: 10px;
    color: #555;
}

.per-page-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
}

/* Sortable headers */
.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 20px;
}

.sortable::after {
    content: '⇕';
    position: absolute;
    right: 5px;
    color: #999;
    font-size: 0.8em;
}

.sortable.asc::after {
    content: '↑';
    color: #4CAF50;
}

.sortable.desc::after {
    content: '↓';
    color: #4CAF50;
}

/* Responsive pagination */
@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .per-page-container {
        margin-left: 0;
        width: 100%;
    }
}