/* styles.css - Responsive design for Vero Site */

/* ==================== GLOBAL STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

/* ==================== HEADER ==================== */
header {
    background: linear-gradient(135deg, #00FFFF 0%, #1e5dbb 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);

}

header h1 {
    font-size: 3.8rem;
    font-family: garamond;
    color: #fff;
    letter-spacing: 2px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3), 0 0 30px rgba(255,255,255,0.2);
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* ==================== SEARCH BAR ==================== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    max-width: 600px;
}

.search-bar input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
}

.search-bar button {
    padding: 12px 25px;
    background-color: #fff;
    color: #667eea;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-bar button:hover {
    background-color: #f0f0f0;
    transform: translateY(-2px);
}

/* ==================== BUTTONS ==================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5568d3;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #fff;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background-color: #f0f0f0;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.875rem;
}

.btn-edit {
    background-color: #4CAF50;
    color: white;
}

.btn-edit:hover {
    background-color: #45a049;
}

.btn-delete {
    background-color: #f44336;
    color: white;
}

.btn-delete:hover {
    background-color: #da190b;
}

/* ==================== MAIN CONTENT ==================== */
main {
    padding: 30px 20px;
    min-height: calc(100vh - 200px);
}

/* ==================== ITEMS GRID (STOREFRONT) ==================== */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.item-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.item-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background-color: #f0f0f0;
    flex-shrink: 0;
}

.item-image img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.item-details {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.item-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.item-price {
    font-size: 1.3rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
    margin-top: auto;
}

.item-quantity {
    color: #666;
    font-size: 0.85rem;
}

/* ==================== LOADING & NO RESULTS ==================== */
.loading {
    text-align: center;
    padding: 50px;
    font-size: 1.2rem;
    color: #666;
}

.no-results {
    text-align: center;
    padding: 50px;
    font-size: 1.2rem;
    color: #999;
}

.error {
    text-align: center;
    padding: 50px;
    color: #f44336;
    font-size: 1.2rem;
}

/* ==================== MODAL ==================== */
.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);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideDown 0.3s ease;
}

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

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1;
}

.close:hover,
.close:focus {
    color: #000;
}

/* ==================== MODAL BODY (ITEM DETAIL) ==================== */
.modal-body {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-top: 20px;
}

.modal-images-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.modal-main-image {
    width: 100%;
    max-width: 500px;
    height: 400px;
    background-color: #f5f5f5;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-main-image img {
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.modal-thumbnails {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 500px;
}

.thumbnail-img {
    width: 70px !important;
    height: 70px !important;
    min-width: 70px;
    min-height: 70px;
    max-width: 70px;
    max-height: 70px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.thumbnail-img:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.thumbnail-img.active {
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.modal-info-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-item-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    margin: 0;
    line-height: 1.2;
}

.modal-price-stock {
    display: flex;
    gap: 20px;
    align-items: center;
}

.modal-item-price {
    font-size: 1.8rem;
    font-weight: bold;
    color: #667eea;
    margin: 0;
}

.modal-stock {
    font-size: 1rem;
    color: #666;
    margin: 0;
}

.modal-description {
    margin-top: 10px;
}

.modal-description h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #555;
    margin: 0 0 10px 0;
}

.modal-description p {
    font-size: 1rem;
    line-height: 1.6;
    color: #666;
    margin: 0;
}

.modal-details p {
    margin-bottom: 15px;
    color: #666;
    line-height: 1.8;
}

.item-info {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.item-info .price {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.item-info .quantity {
    font-size: 1.1rem;
    color: #666;
}

/* ==================== ADMIN STYLES ==================== */
.admin-items-list {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.admin-items-list h2 {
    margin-bottom: 20px;
    color: #333;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background-color: #667eea;
    color: white;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table tbody tr:hover {
    background-color: #f5f5f5;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

/* ==================== FORM STYLES ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

hr {
    margin: 30px 0;
    border: none;
    border-top: 1px solid #ddd;
}

/* ==================== IMAGE MANAGEMENT ==================== */
.current-images h4 {
    margin-bottom: 15px;
    color: #333;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.image-card {
    position: relative;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f9f9f9;
}

.image-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.image-info {
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.seq-badge {
    background-color: #667eea;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: bold;
}

/* ==================== RESPONSIVE DESIGN ==================== */

/* Tablets and smaller desktops */
@media (max-width: 1024px) {
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .modal-body {
        grid-template-columns: 1fr;
    }
    
    .main-image-container {
        height: 300px;
    }
}

/* Tablets */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .search-bar {
        flex-direction: column;
    }
    
    .search-bar button {
        width: 100%;
    }
    
    .items-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .item-image {
        height: 200px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .header-actions .btn {
        width: 100%;
        text-align: center;
    }
    
    .modal-content {
        margin: 20px auto;
        width: 95%;
        padding: 20px;
    }
    
    .modal-main-image {
        height: 300px;
        max-width: 100%;
    }
    
    .modal-thumbnails {
        max-width: 100%;
    }
    
    .thumbnail-img {
        width: 60px !important;
        height: 60px !important;
        min-width: 60px;
        min-height: 60px;
        max-width: 60px;
        max-height: 60px;
    }
    
    .modal-item-name {
        font-size: 1.5rem;
    }
    
    .modal-item-price {
        font-size: 1.5rem;
    }
    
    .modal-price-stock {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    table {
        font-size: 0.9rem;
    }
    
    table th,
    table td {
        padding: 8px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.3rem;
    }
    
    .items-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .item-card {
        max-width: 100%;
    }
    
    .item-image {
        height: 250px;
    }
    
    .modal-content {
        margin: 10px;
        width: calc(100% - 20px);
    }
    
    .modal-main-image {
        height: 250px;
        max-width: 100%;
    }
    
    .thumbnail-img {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px;
        min-height: 50px;
        max-width: 50px;
        max-height: 50px;
    }
    
    .modal-item-name {
        font-size: 1.3rem;
    }
    
    .modal-item-price {
        font-size: 1.3rem;
        padding: 15px;
    }
    
    .main-image-container {
        height: 250px;
    }
    
    .thumbnail {
        width: 60px;
        height: 60px;
    }
    
    .modal-details h2 {
        font-size: 1.5rem;
    }
    
    .item-info .price {
        font-size: 1.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
    
    /* Make admin table scrollable on mobile */
    #itemsTable {
        overflow-x: auto;
    }
    
    table {
        min-width: 600px;
    }
    
    .images-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

/* Very small screens */
@media (max-width: 320px) {
    .container {
        padding: 0 10px;
    }
    
    header h1 {
        font-size: 1.1rem;
    }
    
    .item-name {
        font-size: 1rem;
    }
    
    .item-price {
        font-size: 1.3rem;
    }
}
