/* ===========================================
   COMPONENTS - Buttons, Cards, Forms, etc.
   =========================================== */

/* ===========================================
   BUTTONS
   =========================================== */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    letter-spacing: 0.01em;
}

.btn-primary {
    background-color: #3665f3;
    color: white;
    box-shadow: 0 2px 8px rgba(54, 101, 243, 0.22);
}

.btn-primary:hover {
    background-color: #2348c5;
    box-shadow: 0 4px 14px rgba(54, 101, 243, 0.32);
    transform: translateY(-1px);
    text-decoration: none;
}

.btn-secondary {
    background-color: #fff;
    color: #3665f3;
    border: 1.5px solid #3665f3;
}

.btn-secondary:hover {
    background-color: #f0f4ff;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: #e53238;
    color: white;
    box-shadow: 0 2px 8px rgba(229, 50, 56, 0.2);
}

.btn-danger:hover {
    background-color: #c41e24;
    transform: translateY(-1px);
}

.btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.track-button {
    background-color: #c41e3a;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    line-height: 1.3;
    font-family: inherit;
}

.track-button:hover {
    background-color: #a01830;
}

/* Top bar buttons */
.top-bar-btn {
    padding: 4px 10px;
    margin: 0 0px;
    cursor: pointer;
    border: 0;
    background: transparent;
    border-radius: 6px;
    font-size: 12px;
    color: #374151;
    font-family: inherit;
    transition: background 0.15s;
}

.top-bar-btn:hover {
    background: #f0f0f2;
    text-decoration: none;
}

/* ===========================================
   FORM ELEMENTS
   =========================================== */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #374151;
    letter-spacing: 0.01em;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    color: #1a1a1a;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: #3665f3;
    box-shadow: 0 0 0 3px rgba(54, 101, 243, 0.12);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Search box */
.search-box {
    flex: 1;
    display: flex;
    border: 1.5px solid #3665f3;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(54, 101, 243, 0.1);
    transition: box-shadow 0.15s;
}

.search-box:focus-within {
    box-shadow: 0 0 0 3px rgba(54, 101, 243, 0.12);
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    outline: none;
    font-size: 15px;
    font-family: inherit;
}

.search-btn {
    background-color: #3665f3;
    color: white;
    border: none;
    padding: 0 24px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background-color 0.15s;
    border-radius: 8px 8px 8px 8px;
}

.search-btn:hover {
    background-color: #2348c5;
}

/* ===========================================
   TOGGLE SWITCH
   =========================================== */

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #3665f3;
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.toggle-row:last-child {
    border-bottom: none;
}

.toggle-info {
    flex: 1;
}

.toggle-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.toggle-description {
    font-size: 13px;
    color: #707070;
}

/* ===========================================
   CARDS
   =========================================== */

.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}

/* Product cards */
.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    border: 1px solid #ebebeb;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    border-color: transparent;
}

.product-image {
    width: 100%;
    height: 220px;
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    color: #ccc;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    padding: 16px;
}

.product-title {
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    height: 40px;
    overflow: hidden;
}

.product-price {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.product-shipping {
    font-size: 12px;
    color: #707070;
}

.product-seller {
    font-size: 12px;
    color: #707070;
    margin-top: 4px;
}

.product-condition {
    font-size: 12px;
    color: #707070;
    margin-top: 4px;
}

.product-zip {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 3px;
}

/* Item cards (profile page) */
.item-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.item-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-details {
    padding: 15px;
}

.item-name {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.item-price {
    font-size: 20px;
    font-weight: bold;
    color: #c41e3a;
    margin-bottom: 8px;
}

.item-condition {
    font-size: 12px;
    color: #555;
    padding: 3px 10px;
    background: #f0f0f2;
    border-radius: 20px;
    display: inline-block;
    font-weight: 500;
}

/* Category cards */
.category-card {
    background: white;
    padding: 20px;
    border-radius: 14px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    border: 1px solid #ebebeb;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.09);
    border-color: transparent;
}

.category-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.category-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

/* ===========================================
   BADGES
   =========================================== */

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge.verified {
    background: #e3f2fd;
    color: #1976d2;
}

.badge.trusted {
    background: #e8f5e9;
    color: #388e3c;
}

.badge.member-since {
    background: #fff3e0;
    color: #f57c00;
}

.sold-badge {
    background: #dc2626;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.cart-badge {
    display: inline-block;
    background: #c41e3a;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 4px;
}

/* ===========================================
   LOADING & SPINNERS
   =========================================== */

.loading {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
}

.spinner,
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3665f3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner {
    width: 50px;
    height: 50px;
    border-width: 5px;
    border-top-color: #c41e3a;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-products {
    text-align: center;
    padding: 40px;
    color: #707070;
}

/* ===========================================
   MESSAGES (Success, Error, Warning)
   =========================================== */

.success-message {
    background: #ecfdf5;
    color: #065f46;
    padding: 12px 16px;
    border-radius: 10px;
    border-left: 4px solid #10b981;
    margin-bottom: 20px;
    display: none;
    font-size: 14px;
}

.error-message {
    background: #fef2f2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 10px;
    border-left: 4px solid #ef4444;
    margin-bottom: 20px;
    display: none;
    font-size: 14px;
}

.warning-box {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 14px 16px;
    margin-bottom: 20px;
    border-radius: 10px;
}

.warning-box p {
    margin: 0;
    color: #92400e;
    font-size: 14px;
}

/* ===========================================
   TOAST NOTIFICATIONS
   =========================================== */

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #333;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 400px;
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

@keyframes slideIn {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(400px); opacity: 0; }
}

.toast.hiding {
    animation: slideOut 0.3s ease-out forwards;
}

/* ===========================================
   EMPTY STATES
   =========================================== */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #707070;
}

.empty-icon {
    font-size: 60px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* No results */
.no-results {
    background: #fff;
    padding: 60px 40px;
    border-radius: 8px;
    text-align: center;
}

.no-results-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.no-results-title {
    font-size: 24px;
    margin-bottom: 10px;
    color: #333;
}

.no-results-text {
    font-size: 16px;
    color: #707070;
    margin-bottom: 20px;
}

/* ===========================================
   STARS / RATINGS
   =========================================== */

.stars {
    color: #ffc107;
    font-size: 16px;
}

.rating-text {
    font-size: 18px;
    color: #333;
    font-weight: bold;
}

.rating-count {
    font-size: 14px;
    color: #707070;
}

/* ===========================================
   INFO ROWS (Settings pages)
   =========================================== */

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 14px;
    color: #707070;
    font-weight: 500;
}

.info-value {
    font-size: 14px;
    color: #333;
    font-weight: 600;
}

/* ===========================================
   SECTIONS
   =========================================== */

.section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.07);
    margin-bottom: 24px;
}

.settings-section {
    background: #fff;
    padding: 28px 30px;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

/* ===========================================
   GRIDS
   =========================================== */

.products-grid,
.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

/* ===========================================
   DROPDOWN MENU
   =========================================== */

.user-menu-container {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    border: 1px solid #ebebeb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    min-width: 180px;
    margin-top: 0px;
    z-index: 1000;
    overflow: hidden;
}

.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-menu a:last-child {
    border-bottom: none;
}

.dropdown-menu a:hover {
    background-color: #f5f5f5;
}

.user-menu-container:hover .dropdown-menu {
    display: block;
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 768px) {
    /* Buttons */
    .button-group {
        flex-direction: column;
    }

    /* Search button easier to tap */
    .search-btn {
        padding: 0 16px;
        font-size: 14px;
    }

    /* Cards */
    .card {
        margin-bottom: 12px;
    }

    /* Sections: reduce padding on mobile */
    .section {
        padding: 16px;
        border-radius: 8px;
    }

    .settings-section {
        padding: 16px;
    }

    /* Info rows: stack label/value vertically */
    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    /* Grids */
    .items-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* Product image height */
    .product-image {
        height: 160px;
    }

    .item-image {
        height: 150px;
    }

    /* Category cards: smaller padding */
    .category-card {
        padding: 12px 8px;
    }

    .category-icon {
        font-size: 28px;
        margin-bottom: 6px;
    }

    .category-name {
        font-size: 12px;
    }

    /* Toast: full-width at bottom */
    .toast {
        bottom: 0;
        right: 0;
        left: 0;
        border-radius: 8px 8px 0 0;
        max-width: none;
    }

    /* Form elements: larger tap targets */
    .form-input,
    .form-textarea,
    .form-select {
        font-size: 16px; /* prevents iOS zoom on focus */
        padding: 14px 12px;
    }

    .search-input {
        font-size: 16px; /* prevents iOS zoom */
    }
}

@media (max-width: 480px) {
    .items-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .btn {
        font-size: 15px;
        padding: 11px 20px;
    }

    .product-image {
        height: 140px;
    }

    /* Badges: smaller on tiny screens */
    .badge {
        font-size: 11px;
        padding: 4px 8px;
    }

    /* No-results on tiny screens */
    .no-results {
        padding: 30px 16px;
    }

    .no-results-icon {
        font-size: 48px;
        margin-bottom: 12px;
    }

    .no-results-title {
        font-size: 20px;
    }
}
