:root {
    --primary-color: #4a6fa5;
    --secondary-color: #166088;
    --accent-color: #4fc3f7;
    --background-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-color: #333;
    --light-text: #666;
    --border-color: #ddd;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --tab-active-color: #4a6fa5;
    --tab-inactive-color: #ccc;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --theme-toggle-bg: #f0f0f0;
    --instagram-color: #666;
    --modal-overlay: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] {
    --primary-color: #6a8fc5;
    --secondary-color: #3a80b8;
    --accent-color: #6fd3f7;
    --background-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --light-text: #a0a0a0;
    --border-color: #333;
    --success-color: #6cbf6f;
    --warning-color: #ffb74d;
    --error-color: #f6685e;
    --tab-active-color: #6a8fc5;
    --tab-inactive-color: #555;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    --theme-toggle-bg: #333;
    --instagram-color: #a0a0a0;
    --modal-overlay: rgba(0, 0, 0, 0.8);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.hidden {
    display: none !important;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
}

.header-container h1 {
    margin: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    color: var(--primary-color);
}

.theme-toggle-container {
    display: flex;
    justify-content: flex-end;
    width: 40px;
}

.theme-toggle {
    background: var(--theme-toggle-bg);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-color);
    font-size: 16px;
}

h1, h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

input, textarea, button, select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    background-color: var(--card-bg);
    color: var(--text-color);
}

textarea {
    min-height: 80px;
    resize: vertical;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.2s;
}

button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

.icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.tabs {
    display: flex;
    gap: 5px;
    flex: 1;
    min-width: 0;
}

.tab-button {
    background-color: var(--tab-inactive-color);
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-button.active {
    background-color: var(--tab-active-color);
}

.header-buttons {
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 0;
    justify-content: flex-end;
}

header button {
    width: auto;
    padding: 10px 15px;
    white-space: nowrap;
}

#category-filter {
    margin-bottom: 15px;
}

#category-filter select {
    width: 100%;
    min-width: 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.reviews-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.review-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
}

.review-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.review-card h3 {
    color: var(--secondary-color);
    margin-bottom: 10px;
    word-break: break-word;
}

.review-card .category {
    display: inline-block;
    background-color: var(--theme-toggle-bg);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 10px;
    color: var(--text-color);
    width: 100%;
    text-align: center;
}

.review-card .author {
    color: var(--light-text);
    font-size: 14px;
    margin-bottom: 5px;
}

.review-card .location {
    color: var(--light-text);
    font-size: 14px;
    margin-bottom: 10px;
}

.review-card .instagram {
    color: var(--instagram-color);
    font-size: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.review-card .instagram i {
    font-size: 16px;
}

.review-card .instagram:hover {
    text-decoration: underline;
}

.rating-low {
    background-color: #FFADAD !important;
    color: #333 !important;
}

.rating-medium {
    background-color: #FFFACD !important;
    color: #333 !important;
}

.rating-high {
    background-color: #A0C4FF !important;
    color: #333 !important;
}

.rating-perfect {
    background-color: #CAFFBF !important;
    color: #333 !important;
}

.rating {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
    margin-bottom: 10px;
    width: 100%;
    text-align: center;
}

.review-images {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    overflow-x: auto;
    padding-bottom: 5px;
}

.review-image {
    height: 100px;
    border-radius: 4px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

.review-image:hover {
    transform: scale(1.03);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.review-card .pros-cons {
    display: flex;
    margin-bottom: 10px;
    gap: 15px;
    flex-direction: column;
}

.review-card .pros, .review-card .cons {
    flex: 1;
}

.review-card .pros h4 {
    color: var(--success-color);
    margin-bottom: 5px;
}

.review-card .cons h4 {
    color: var(--error-color);
    margin-bottom: 5px;
}

.review-card .pros ul, .review-card .cons ul {
    padding-left: 20px;
    font-size: 14px;
}

.review-card .notes {
    font-size: 14px;
    color: var(--light-text);
    margin-top: 10px;
    flex-grow: 1;
}

.review-card .actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

.review-card .actions button {
    width: auto;
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 4px;
}

.review-card .actions .edit-btn {
    background-color: var(--warning-color);
}

.review-card .actions .delete-btn {
    background-color: var(--error-color);
}

.review-card .actions .visit-btn {
    background-color: var(--success-color);
}

.rating-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.rating-container label {
    min-width: 100px;
}

.rating-container input {
    width: 80px;
    text-align: center;
}

.form-buttons {
    display: flex;
    gap: 10px;
}

.form-buttons button {
    flex: 1;
}

.form-buttons #cancel-btn {
    background-color: var(--error-color);
}

.form-group {
    margin-bottom: 15px;
}

.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.image-preview {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.image-preview-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
}

.remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--error-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    border: none;
    padding: 0;
}

.error-message {
    color: var(--error-color);
    margin-bottom: 15px;
    text-align: center;
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    overflow-y: auto;
}

.modal.hidden {
    display: none;
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    padding: 25px;
    border-radius: 8px;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin: 20px 0;
}

#review-modal .modal-content {
    max-width: 700px;
    max-height: 90vh;
}

#review-form {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#modal-image {
    max-height: 80vh;
    max-width: 90vw;
    object-fit: contain;
}

.close-modal {
    position: fixed;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    border: 2px solid white;
}

.close-modal:hover {
    color: #ccc;
}

.modal-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    pointer-events: none;
}

.nav-button {
    pointer-events: all;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    margin: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-button:hover {
    background: rgba(0, 0, 0, 0.8);
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .header-container h1 {
        position: static;
        transform: none;
        order: -1;
        white-space: normal;
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }
    
    .app-title {
        display: block;
        margin-bottom: 20px;
        text-align: center;
    }
    
    /* .header-container .theme-toggle-container {
        align-self: flex-end;
        margin-left: 0;
    } */
    
    header {
        flex-direction: column;
    }
    
    .tabs, .header-buttons {
        width: 100%;
    }
    
    .tab-button, header button {
        width: 100%;
        padding: 10px;
    }
    
    .reviews-grid {
        grid-template-columns: 1fr;
    }
    
    .review-card .pros-cons {
        flex-direction: column;
    }
    
    .modal-content {
        max-width: 95%;
    }
    
    .close-modal {
        font-size: 32px;
        width: 50px;
        height: 50px;
        top: 15px;
        right: 15px;
    }
    
    .form-buttons {
        flex-direction: column;
    }
    
    .form-buttons button {
        width: 100%;
    }

    .rating-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .rating-container input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    input, textarea, button, select {
        padding: 10px;
    }
    
    .review-card {
        padding: 12px;
    }
    
    .review-card .actions {
        flex-direction: column;
    }
    
    .review-card .actions button {
        width: 100%;
    }

    .review-card .category, 
    .review-card .rating {
        font-size: 14px;
        padding: 8px;
    }
}

@media (max-height: 700px) {
    .modal-content {
        max-height: 80vh;
    }
    
    #review-modal .modal-content {
        max-height: 85vh;
    }
}