/* Wheel Fitment Plugin Styles */

.wheel-fitment-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.wheel-fitment-header {
    text-align: center;
    margin-bottom: 40px;
}

.wheel-fitment-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #333;
}

.wheel-fitment-header p {
    font-size: 1.1em;
    color: #666;
}

.wheel-fitment-content {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 40px;
}

/* Upload Section */
.upload-section {
    margin-bottom: 30px;
}

.upload-section-balance {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #f0f8ff;
    border-radius: 8px;
    border-left: 4px solid #0073aa;
}

.upload-section-balance p {
    margin: 0;
    font-size: 1em;
    color: #333;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.upload-section-balance span {
    font-weight: 600;
    color: #0073aa;
}

.btn-logout {
    margin-left: auto;
    padding: 8px 16px;
    font-size: 0.9em;
    color: #666;
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    color: #333;
    border-color: #999;
    background: #f5f5f5;
}

.main-content-with-support {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.support-section {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-support {
    padding: 12px 20px;
    background: #22c55e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-support:hover {
    background: #16a34a;
}

.btn-gallery-link {
    display: inline-block;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}

.btn-gallery-link:hover {
    background: #16a34a;
}

.btn-history.history-tab[data-tab="history"] {
    background: #ff9712;
    border-color: #ff9712;
    color: #fff;
}

.btn-history.history-tab[data-tab="history"]:hover {
    background: #e68610;
    border-color: #e68610;
}

.btn-history.history-tab[data-tab="history"].active {
    background: #ff9712;
    border-color: #ff9712;
    color: #fff;
}

.btn-history.history-tab[data-tab="history"].active:hover {
    background: #e68610;
    border-color: #e68610;
}

.btn-history.history-tab[data-tab="new"].active {
    background: #0073aa;
}

.btn-history.history-tab[data-tab="new"].active:hover {
    background: #005a87;
}

.support-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.support-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
}

.support-modal-content {
    position: relative;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}

.support-modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}

.support-modal-close:hover {
    color: #333;
}

.insufficient-funds-modal .support-modal-content p {
    margin: 0 0 10px;
}
.insufficient-funds-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.insufficient-funds-actions .btn-primary,
.insufficient-funds-actions .btn-secondary {
    flex: 1;
    min-width: 120px;
}

.support-modal-content h3 {
    margin: 0 0 15px;
}

.support-tg-link {
    margin: 0 0 20px;
}

.support-tg-link a {
    color: #0088cc;
    font-weight: 600;
}

.support-form-note {
    margin: 0 0 15px;
    font-size: 0.95em;
    color: #666;
}

.support-form .support-form-group {
    margin-bottom: 15px;
}

.support-form .support-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.support-form .support-form-group input,
.support-form .support-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
}

.support-form .support-form-group textarea {
    resize: vertical;
}

.support-form .btn-primary {
    margin-top: 5px;
    width: 100%;
}

.upload-form-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
    flex: 1;
}

.generation-options {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #eee;
}

.generation-options h4 {
    margin: 0 0 15px;
    font-size: 1em;
    color: #333;
}

.opt-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
}

.opt-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.opt-checkbox-box {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid #ccc;
    border-radius: 4px;
    margin-right: 10px;
    background: #fff;
    transition: all 0.2s ease;
}

.opt-checkbox input:checked + .opt-checkbox-box {
    border-color: #22c55e;
    background: #22c55e url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center;
    background-size: 14px;
}

.opt-price {
    color: #0073aa;
    font-size: 0.9em;
}

.generation-options.first-trial .opt-price {
    display: none;
}

.opt-repaint-color,
.opt-diameter-select {
    margin: 10px 0 15px 24px;
}

.opt-repaint-color input[type="color"] {
    width: 40px;
    height: 30px;
    padding: 2px;
    cursor: pointer;
    vertical-align: middle;
}

.opt-repaint-color span {
    margin-left: 10px;
    font-size: 0.9em;
}

.opt-diameter-select select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.first-trial-message {
    padding: 12px 16px;
    background: #e8f5e9;
    border-radius: 8px;
    color: #2e7d32;
    margin: 0 0 20px;
}

.result-local-link {
    margin: 15px 0;
}

.result-local-link a {
    color: #0073aa;
}

.auth-after-trial-block {
    margin: 15px 0;
}

.auth-after-trial-message {
    padding: 12px 0 10px;
    color: #e65100;
    margin: 0 0 12px;
}

.auth-after-trial-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.auth-after-trial-buttons .btn-telegram,
.auth-after-trial-buttons .btn-vk {
    margin: 0;
}

.history-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.history-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.history-back-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 8px;
    font-size: 1.5em;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s;
}

.history-back-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

.history-header h3 {
    margin: 0;
}

.history-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.history-tab {
    padding: 10px 20px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
}

.history-tab.active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.history-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
}

.history-item a {
    display: block;
}

.history-empty {
    color: #999;
    font-style: italic;
}

.upload-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.upload-item {
    display: flex;
    flex-direction: column;
}

.upload-item label {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: 1.1em;
}

.upload-area {
    position: relative;
    width: 100%;
    min-height: 300px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    pointer-events: auto;
    z-index: 1;
}

.upload-area:hover {
    border-color: #0073aa;
    background: #f9f9f9;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    color: #999;
    text-align: center;
    padding: 20px;
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.upload-placeholder svg {
    margin-bottom: 15px;
    color: #ccc;
}

.upload-placeholder p {
    margin: 0;
    font-size: 0.95em;
}

.upload-area img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

#carPreview,
#wheelPreview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 2;
    pointer-events: none;
}

/* Buttons */
.btn-primary {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 15px 30px;
    font-size: 1.1em;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
    font-weight: 600;
    grid-column: 1 / -1;
    max-width: 300px;
    margin: 0 auto;
}

.btn-primary:hover:not(:disabled) {
    background: #005a87;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    padding: 12px 24px;
    font-size: 1em;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover:not(:disabled) {
    background: #e5e5e5;
    border-color: #999;
}

.btn-secondary:disabled {
    opacity: 0.7;
    cursor: default;
}

.btn-telegram {
    background: #0088cc;
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 1em;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-right: 10px;
}

.btn-telegram:hover {
    background: #006ba3;
}

.btn-vk {
    background: #4c75a3;
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 1em;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-vk:hover {
    background: #3a5a7a;
}

.vkid-widget-container {
    display: inline-block;
    min-height: 44px;
    vertical-align: middle;
}

/* Auth Section */
.auth-section,
.payment-section {
    text-align: center;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 20px;
}

.auth-section h3,
.payment-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.auth-buttons {
    margin-top: 20px;
}

.balance-info {
    margin: 20px 0;
    font-size: 1.1em;
}

.balance-info span {
    font-weight: 600;
    color: #0073aa;
}

.payment-amounts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 25px 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.amount-btn {
    background: #fff;
    border: 2px solid #ddd;
    padding: 15px 20px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
}

.amount-btn:hover {
    border-color: #0073aa;
    background: #f0f8ff;
    transform: translateY(-2px);
}

.amount-btn.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.amount-btn.active:hover {
    background: #005a87;
    border-color: #005a87;
}

/* Loading Section */
.loading-section {
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    margin: 30px 0;
}

.loading-animation {
    margin: 0 auto 30px;
    width: 120px;
    height: 120px;
    position: relative;
}

.spinner-svg {
    width: 100%;
    height: 100%;
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner-circle {
    filter: drop-shadow(0 0 3px rgba(0, 115, 170, 0.3));
}

.spinner-inner {
    filter: drop-shadow(0 0 2px rgba(0, 90, 135, 0.3));
}

.spinner-dot {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.loading-text {
    margin-top: 20px;
}

.loading-title {
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.loading-status {
    color: #666;
    font-size: 1em;
    margin: 10px 0;
    min-height: 24px;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #0073aa;
    animation: bounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Result Section */
.result-section {
    text-align: center;
    padding: 30px;
}

.result-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.result-image-container {
    margin: 30px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.result-image-container img {
    width: 100%;
    max-width: 800px;
    height: auto;
    display: block;
    margin: 0 auto;
}

#newGenerationBtn {
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .wheel-fitment-container {
        padding: 20px 12px;
    }
    
    .wheel-fitment-header {
        margin-bottom: 24px;
    }
    
    .wheel-fitment-header h1 {
        font-size: 1.75em;
        line-height: 1.2;
    }
    
    .wheel-fitment-header p {
        font-size: 1em;
    }
    
    .wheel-fitment-content {
        padding: 20px 16px;
    }
    
    .main-content-with-support {
        flex-direction: column;
    }
    
    .support-section {
        width: 100%;
    }
    
    .btn-support {
        width: 100%;
    }
    
    .upload-form-wrapper {
        grid-template-columns: 1fr;
    }
    
    .upload-form {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 20px;
    }
    
    .upload-area,
    .upload-placeholder {
        min-height: 220px;
    }
    
    .btn-primary {
        width: 100%;
        max-width: none;
        padding: 14px 20px;
    }
    
    .auth-buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-telegram,
    .btn-vk {
        width: 100%;
        margin: 0;
        padding: 14px 20px;
    }
    
    .vkid-widget-container {
        width: 100%;
    }
    
    .btn-logout {
        margin-left: 0;
        min-height: 44px;
        padding: 10px 18px;
    }
    
    .payment-section,
    .auth-section {
        padding: 20px 16px;
    }
    
    .payment-amounts {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        max-width: none;
    }
    
    .amount-btn {
        padding: 14px 12px;
        font-size: 1em;
    }
    
    .loading-section {
        padding: 40px 20px;
    }
    
    .loading-animation {
        width: 90px;
        height: 90px;
    }
    
    .result-image-container img {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .wheel-fitment-container {
        padding: 16px 10px;
    }
    
    .wheel-fitment-header h1 {
        font-size: 1.5em;
    }
    
    .wheel-fitment-content {
        padding: 16px 12px;
    }
    
    .upload-area,
    .upload-placeholder {
        min-height: 180px;
    }
    
    .payment-amounts {
        grid-template-columns: 1fr;
    }
}

/* Error Messages */
.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    border-left: 4px solid #c62828;
}

.success-message {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    border-left: 4px solid #2e7d32;
}

/* Telegram Login Modal */
.telegram-login-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.telegram-login-modal .modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.telegram-login-modal .close-modal {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.telegram-login-modal .close-modal:hover {
    color: #333;
}

.telegram-login-modal h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.telegram-login-modal p {
    margin: 15px 0;
    color: #666;
}

.telegram-login-modal .modal-note {
    margin-top: 25px;
    font-size: 0.9em;
    color: #999;
}

.telegram-login-modal .manual-auth-form {
    margin-top: 20px;
}

.telegram-login-modal .manual-auth-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    box-sizing: border-box;
}

.telegram-login-modal .manual-auth-form input:focus {
    outline: none;
    border-color: #0073aa;
}

.telegram-login-modal .manual-auth-form button {
    width: 100%;
    margin-top: 10px;
}
