:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --page-background: #f5f7fa;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
}

.nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
}

.cart-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    color: white;
    transition: background 0.3s;
}

.cart-link:hover {
    background: rgba(255, 255, 255, 0.3);
}

.cart-icon {
    font-size: 1.3rem;
}

.cart-count {
    background: #ff6b6b;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    min-width: 24px;
}

.main {
    padding: 2rem 0 4rem;
    min-height: calc(100vh - 150px);
}

.hero {
    text-align: center;
    padding: 3rem 2rem;
    background: white;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.hero-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero.has-background-image {
    padding: 0;
}

.hero-image-banner {
    display: none;
    width: 100%;
    aspect-ratio: 16 / 5;
    max-height: 375px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hero.has-background-image .hero-image-banner {
    display: block;
}

.hero.has-background-image .hero-copy {
    padding: 2.4rem 2rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: #666;
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: #333;
}

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

.product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.product-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.product-info {
    padding: 1.2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.product-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    flex: 1;
}

.product-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 1rem;
}

.product-price small {
    font-size: 0.8rem;
    font-weight: 400;
    color: #999;
}

.select-product-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

.select-product-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.select-product-btn:active {
    transform: translateY(0);
}

.select-product-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 550px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: #f5f7fa;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #666;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    z-index: 10;
}

.modal-close:hover {
    background: #e4e7eb;
}

.modal-body {
    padding: 2rem;
}

.modal-product-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.modal-product-name {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.modal-product-description {
    color: #666;
    margin-bottom: 1.5rem;
}

.models-section {
    margin-bottom: 1.5rem;
}

.models-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: #333;
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.8rem;
}

.model-option {
    border: 2px solid #e4e7eb;
    border-radius: 12px;
    padding: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    background: white;
    width: 100%;
    color: inherit;
    font: inherit;
}

.model-option:hover {
    border-color: #667eea;
    background: #f5f7ff;
}

.model-option.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.model-name {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
}

.model-price {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: #667eea;
}

.model-option:disabled,
.model-option.unavailable {
    cursor: not-allowed;
    opacity: 0.58;
    border-color: #e4e7eb;
    background: #f5f7fa;
    box-shadow: none;
}

.model-option.unavailable .model-price {
    color: #777;
    font-size: 0.85rem;
}

.quantity-section {
    margin-bottom: 1.5rem;
}

.quantity-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.quantity-btn {
    width: 44px;
    height: 44px;
    border: 2px solid #e4e7eb;
    background: white;
    border-radius: 10px;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.quantity-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.quantity-value {
    font-size: 1.3rem;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
}

.total-section {
    background: #f5f7fa;
    border-radius: 12px;
    padding: 1rem 1.2rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-label {
    font-weight: 600;
    color: #666;
}

.total-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #667eea;
}

.add-to-cart-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

.add-to-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.add-to-cart-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    transition: transform 0.3s ease;
    font-weight: 500;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: linear-gradient(135deg, #43cea2 0%, #185a9d 100%);
}

.footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
}

.cart-empty {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.cart-empty-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.cart-empty-text {
    font-size: 1.3rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.back-to-shop-btn {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.8rem 1.8rem;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.back-to-shop-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.cart-items {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
}

.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 10px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    flex-shrink: 0;
}

.cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cart-item-name {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.3rem;
}

.cart-item-model {
    color: #667eea;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.cart-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.cart-item-price {
    font-weight: 700;
    font-size: 1.1rem;
    color: #333;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-quantity-btn {
    width: 34px;
    height: 34px;
    border: 2px solid #e4e7eb;
    background: white;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.cart-quantity-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.cart-quantity-value {
    font-weight: 700;
    min-width: 30px;
    text-align: center;
}

.remove-item-btn {
    background: #fee;
    color: #e74c3c;
    border: none;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.remove-item-btn:hover {
    background: #fdd;
}

.cart-summary {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.cart-summary-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    color: #666;
}

.summary-row.total {
    border-top: 2px solid #f0f0f0;
    margin-top: 0.5rem;
    padding-top: 1rem;
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
}

.summary-row.total .summary-value {
    color: #667eea;
}

.checkout-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.clear-cart-btn {
    width: 100%;
    background: white;
    color: #999;
    border: 2px solid #e4e7eb;
    padding: 0.8rem;
    border-radius: 12px;
    font-size: 0.95rem;
    cursor: pointer;
    margin-top: 0.8rem;
    transition: all 0.2s;
}

.clear-cart-btn:hover {
    color: #e74c3c;
    border-color: #e74c3c;
}

.cart-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .cart-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero.has-background-image .hero-copy {
        padding: 1.8rem 1.2rem;
    }

    .logo {
        font-size: 1.4rem;
    }

    .modal-body {
        padding: 1.2rem;
    }

    .modal-product-image {
        height: 200px;
    }

    .modal-product-name {
        font-size: 1.3rem;
    }

    .cart-item {
        flex-direction: column;
    }

    .cart-item-image {
        width: 100%;
        height: 150px;
    }

    .cart-item-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .models-grid {
        grid-template-columns: 1fr 1fr;
    }

    .nav {
        gap: 1rem;
    }
}

.toast.error {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem 0;
    min-height: 70vh;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
    text-align: center;
}

.login-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.login-title {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.login-subtitle {
    color: #666;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.login-form {
    margin-bottom: 1.5rem;
}

.form-group {
    text-align: left;
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e4e7eb;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
    color: #333;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

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

.login-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.9rem;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 0.5rem;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.login-hint {
    background: #f5f7fa;
    border-radius: 10px;
    padding: 1rem;
    font-size: 0.88rem;
    color: #666;
}

.login-hint p {
    margin: 0.2rem 0;
}

.login-hint-small {
    font-size: 0.8rem;
    color: #999;
    margin-top: 0.4rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-subtitle {
    color: #666;
    font-size: 1rem;
}

.admin-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.admin-btn {
    border: none;
    padding: 0.7rem 1.2rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.admin-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.admin-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.admin-btn-secondary {
    background: white;
    color: #666;
    border: 2px solid #e4e7eb;
}

.admin-btn-secondary:hover {
    border-color: #667eea;
    color: #667eea;
}

.admin-btn-edit {
    background: #e8f4fd;
    color: #2980b9;
}

.admin-btn-edit:hover {
    background: #d6ebfb;
}

.admin-btn-delete {
    background: #fde8e8;
    color: #e74c3c;
}

.admin-btn-delete:hover {
    background: #fbd4d4;
}

.admin-btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.admin-product-card {
    display: flex;
    gap: 1.2rem;
    background: white;
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.06);
    align-items: center;
}

.admin-product-img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    flex-shrink: 0;
}

.admin-product-info {
    flex: 1;
    min-width: 0;
}

.admin-models-count {
    display: inline-block;
    background: #f0f0ff;
    color: #667eea;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
}

.admin-stock-total {
    margin-top: 0.45rem;
    color: #555;
    font-size: 0.9rem;
    font-weight: 600;
}

.admin-product-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
}

@media (max-width: 700px) {
    .admin-product-card {
        flex-direction: column;
        align-items: stretch;
    }
    .admin-product-img {
        width: 100%;
        height: 180px;
    }
    .admin-product-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
    .admin-header {
        flex-direction: column;
        align-items: stretch;
    }
    .admin-actions {
        justify-content: stretch;
    }
    .admin-actions .admin-btn {
        flex: 1;
    }
}

.admin-section {
    margin-top: 2rem;
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.admin-section-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #333;
}

.server-storage-section {
    border: 2px solid rgba(143, 62, 210, 0.18);
}

.server-storage-status {
    margin: 0 0 1rem;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-weight: 700;
}

.server-storage-status.success {
    color: #12633a;
    background: #e4f8ed;
}

.server-storage-status.warning {
    color: #7a4a00;
    background: #fff3cf;
}

.server-storage-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.server-file-button {
    cursor: pointer;
}

.server-file-button input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.password-change-form {
    max-width: 500px;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.4rem;
}

@media (max-width: 550px) {
    .form-row {
        flex-direction: column;
    }
    .form-row .form-group:last-child {
        width: 100% !important;
    }
}

.image-preview-wrapper {
    margin-top: 0.8rem;
}

.image-preview {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px dashed #e4e7eb;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.admin-models-list {
    margin-bottom: 1rem;
    min-height: 60px;
}

.admin-model-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1rem;
    background: #f9fafb;
    border-radius: 10px;
    margin-bottom: 0.5rem;
}

.admin-model-name {
    font-weight: 600;
    color: #333;
}

.admin-model-price {
    color: #667eea;
    font-weight: 700;
    font-size: 0.95rem;
    margin-top: 0.2rem;
}

.admin-model-stock {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #555;
    font-size: 0.85rem;
    font-weight: 600;
}

.admin-model-stock input {
    width: 84px;
    padding: 0.45rem 0.55rem;
    border: 2px solid #e4e7eb;
    border-radius: 8px;
    font: inherit;
    background: white;
}

.admin-model-stock input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.admin-add-model {
    display: flex;
    gap: 0.8rem;
    align-items: flex-end;
    flex-wrap: wrap;
    background: #f5f7fa;
    padding: 1rem;
    border-radius: 10px;
}

@media (max-width: 600px) {
    .admin-model-item {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .admin-model-stock {
        justify-content: space-between;
    }

    .admin-add-model {
        flex-direction: column;
        align-items: stretch;
    }
    .admin-add-model .form-group,
    .admin-add-model .admin-btn {
        width: 100% !important;
    }
}

/* Tema personalizável */
body {
    background-color: var(--page-background);
}

.header,
.select-product-btn,
.add-to-cart-btn,
.back-to-shop-btn,
.checkout-btn,
.login-btn,
.admin-btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.hero-title {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.product-price,
.model-price,
.total-value,
.cart-item-model,
.summary-row.total .summary-value,
.admin-models-count,
.admin-model-price {
    color: var(--primary-color);
}

.model-option:hover,
.model-option.selected,
.quantity-btn:hover,
.form-input:focus,
.admin-btn-secondary:hover {
    border-color: var(--primary-color);
}

/* Personalização no painel */
.settings-note {
    color: #666;
    margin: -0.4rem 0 1.4rem;
}

.customization-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
}

.customization-full-row {
    grid-column: 1 / -1;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.color-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 58px;
    padding: 0.7rem 0.9rem;
    border: 2px solid #e4e7eb;
    border-radius: 10px;
    color: #555;
    font-weight: 600;
    cursor: pointer;
}

.color-input {
    width: 50px;
    height: 36px;
    padding: 2px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
}

.customization-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.hero-background-settings {
    padding: 1.2rem;
    margin-bottom: 1.4rem;
    border: 2px solid #e4e7eb;
    border-radius: 14px;
    background: #f9fafb;
}

.hero-background-title {
    margin-bottom: 0.35rem;
    color: #333;
    font-size: 1.05rem;
}

.resolution-hint {
    margin-bottom: 1.1rem;
    color: #666;
    font-size: 0.9rem;
}

.hero-background-inputs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.field-help {
    display: block;
    margin-top: 0.4rem;
    color: #777;
    font-size: 0.8rem;
}

.hero-background-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 5;
    min-height: 130px;
    margin-bottom: 0.55rem;
    border: 2px dashed #cfd4dc;
    border-radius: 12px;
    background: white;
    background-size: cover;
    background-position: center;
    color: #888;
    overflow: hidden;
}

.hero-background-preview.has-image {
    border-style: solid;
}

.image-resolution-info {
    min-height: 1.4rem;
    margin-bottom: 0.9rem;
    color: #666;
    font-size: 0.9rem;
}

.admin-btn-preview {
    color: var(--primary-color);
    background: #f0f0ff;
    text-decoration: none;
}

.admin-btn-preview:hover {
    color: white;
    background: var(--primary-color);
}

.checkout-btn.whatsapp-checkout {
    background: #25d366;
}

.checkout-btn.whatsapp-checkout:hover {
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35);
}

.payment-method-selector {
    margin-top: 1rem;
}

.payment-method-selector label {
    display: block;
    margin-bottom: 0.45rem;
    color: #555;
    font-weight: 600;
}

@media (max-width: 700px) {
    .customization-grid,
    .color-grid,
    .hero-background-inputs {
        grid-template-columns: 1fr;
    }

    .customization-actions > * {
        width: 100%;
    }
}

/* Ajustes completos para celulares e tablets */
html {
    -webkit-text-size-adjust: 100%;
}

img,
input,
select,
textarea,
button {
    max-width: 100%;
}

.logo,
.hero-title,
.product-name,
.modal-product-name,
.cart-item-name {
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    .container {
        width: 100%;
        padding-inline: 16px;
    }

    .header {
        padding: 0.7rem 0;
    }

    .header-content {
        gap: 0.65rem;
    }

    .logo {
        max-width: 100%;
        font-size: clamp(1.15rem, 5.5vw, 1.4rem);
        line-height: 1.25;
        text-align: center;
    }

    .nav {
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
    }

    .nav-link,
    .cart-link {
        min-height: 44px;
        padding: 0.55rem 0.8rem;
        align-items: center;
        justify-content: center;
        font-size: 0.95rem;
    }

    .main {
        padding: 1.25rem 0 2.5rem;
        min-height: calc(100vh - 180px);
    }

    .hero {
        margin-bottom: 1.5rem;
        padding: 2rem 1rem;
        border-radius: 14px;
    }

    .hero.has-background-image .hero-copy {
        padding: 1.5rem 1rem;
    }

    .hero-image-banner,
    .hero-background-preview {
        aspect-ratio: 16 / 7;
        min-height: 0;
    }

    .hero-image-banner {
        background-color: #080413;
        background-size: contain;
    }

    .hero-title {
        font-size: clamp(1.55rem, 7vw, 2rem);
        line-height: 1.2;
        margin-bottom: 0.7rem;
    }

    .hero-subtitle {
        font-size: 1rem;
        line-height: 1.5;
    }

    .section-title {
        margin-bottom: 1rem;
        font-size: 1.5rem;
        line-height: 1.25;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
        gap: 1rem;
    }

    .product-card {
        border-radius: 14px;
    }

    .product-image {
        height: clamp(180px, 54vw, 240px);
    }

    .product-info {
        padding: 1rem;
    }

    .modal {
        align-items: flex-end;
        padding: 8px 8px 0;
    }

    .modal-content {
        width: 100%;
        max-width: none !important;
        max-height: calc(100dvh - 8px);
        border-radius: 18px 18px 0 0;
        overscroll-behavior: contain;
    }

    .modal-body {
        padding: 3.4rem 1rem 1.25rem !important;
    }

    .modal-close {
        top: 10px;
        right: 12px;
        width: 44px;
        height: 44px;
    }

    .modal-product-image {
        height: clamp(175px, 52vw, 230px);
        margin-bottom: 1rem;
    }

    .models-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem;
    }

    .model-option {
        min-height: 68px;
        padding: 0.7rem 0.5rem;
    }

    .quantity-btn,
    .cart-quantity-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .add-to-cart-btn,
    .checkout-btn,
    .clear-cart-btn,
    .login-btn,
    .admin-btn,
    .select-product-btn {
        min-height: 46px;
    }

    .toast {
        bottom: calc(16px + env(safe-area-inset-bottom));
        width: calc(100% - 32px);
        padding: 0.85rem 1rem;
        text-align: center;
    }

    .cart-layout {
        gap: 1rem;
    }

    .cart-items,
    .cart-summary,
    .cart-empty {
        padding: 1rem;
        border-radius: 14px;
    }

    .cart-empty {
        padding-block: 2.5rem;
    }

    .cart-empty-icon {
        font-size: 3.5rem;
    }

    .cart-item {
        gap: 0.8rem;
        padding: 0.8rem 0;
    }

    .cart-item-image {
        height: clamp(150px, 48vw, 220px);
    }

    .cart-item-bottom,
    .cart-item-controls {
        width: 100%;
    }

    .cart-item-controls {
        justify-content: space-between;
        gap: 0.6rem;
    }

    .summary-row.total {
        gap: 1rem;
        font-size: 1.1rem;
    }

    .login-wrapper {
        min-height: auto;
        padding: 1.25rem 0;
    }

    .login-card {
        padding: 1.5rem 1rem;
        border-radius: 16px;
    }

    .login-icon {
        font-size: 3rem;
    }

    .login-title {
        font-size: 1.5rem;
    }

    .admin-section {
        margin-top: 1.25rem;
        padding: 1rem;
        border-radius: 14px;
    }

    .admin-product-card {
        gap: 0.9rem;
    }

    .admin-actions,
    .admin-product-actions,
    .server-storage-actions {
        width: 100%;
    }

    .admin-actions .admin-btn,
    .admin-product-actions .admin-btn,
    .server-storage-actions .admin-btn {
        flex: 1 1 140px;
    }

    .admin-model-item {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-model-stock {
        width: 100%;
        justify-content: space-between;
    }

    .admin-model-stock input {
        width: 110px;
        min-height: 44px;
    }

    .admin-model-item .admin-btn-delete {
        width: 100%;
    }

    .product-form-actions {
        flex-direction: column;
    }

    .product-form-actions .admin-btn {
        width: 100% !important;
    }

    .image-preview {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 10;
    }

    .color-field {
        min-height: 64px;
    }

    .hero-background-settings {
        padding: 1rem;
    }

    .footer {
        padding: 1.2rem 0 calc(1.2rem + env(safe-area-inset-bottom));
    }

    .footer p {
        font-size: 0.9rem;
        line-height: 1.7;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 420px) {
    .container {
        padding-inline: 12px;
    }

    .nav {
        gap: 0.35rem;
    }

    .nav-link,
    .cart-link {
        padding-inline: 0.65rem;
        font-size: 0.9rem;
    }

    .hero-image-banner,
    .hero-background-preview {
        aspect-ratio: 16 / 8;
    }

    .product-image {
        height: 190px;
    }

    .cart-item-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .cart-item-quantity {
        justify-content: space-between;
        width: 100%;
    }

    .remove-item-btn {
        min-height: 44px;
        width: 100%;
    }

    .summary-row {
        gap: 0.75rem;
    }

    .summary-value {
        text-align: right;
    }

    .customization-actions,
    .admin-actions,
    .admin-product-actions,
    .server-storage-actions {
        flex-direction: column;
    }

    .admin-actions .admin-btn,
    .admin-product-actions .admin-btn,
    .server-storage-actions .admin-btn {
        width: 100%;
        flex-basis: auto;
    }
}

@media (max-width: 340px) {
    .models-grid {
        grid-template-columns: 1fr;
    }

    .nav-link,
    .cart-link {
        padding-inline: 0.5rem;
        font-size: 0.85rem;
    }
}

@media (hover: none) {
    .product-card:hover,
    .select-product-btn:hover,
    .add-to-cart-btn:hover,
    .checkout-btn:hover,
    .login-btn:hover,
    .admin-btn-primary:hover {
        transform: none;
    }
}
