/* =========================================
   DESIGN SYSTEM PAGE
   ========================================= */

.design-system-main {
    padding: 40px 20px 80px;
    min-height: 100vh;
    background: var(--bg-body);
}

.design-header {
    text-align: center;
    margin-bottom: 40px;
}

.design-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.design-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.design-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    align-items: start;
}

/* Card Styles */
.design-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 30px;
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-header-design {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-subtle);
}

.icon-design {
    font-size: 1.5rem;
    color: var(--c-accent);
    padding: 10px;
    border-radius: 12px;
    background: rgba(37, 58, 132, 0.05);
}

/* Form Layout */
.form-row-design {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group-design {
    margin-bottom: 20px;
}

.form-group-design label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--bg-body);
    color: var(--text-main);
    font-family: inherit;
    transition: all 0.2s;
}

.input-wrapper input:focus {
    border-color: var(--c-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 58, 132, 0.1);
}

.unit-badge {
    position: absolute;
    right: 15px;
    color: var(--text-muted);
    font-weight: 600;
}

[dir="rtl"] .unit-badge {
    right: auto;
    left: 15px;
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--bg-body);
    color: var(--text-main);
    appearance: none;
    cursor: pointer;
}

.select-arrow {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
}

[dir="rtl"] .select-arrow {
    right: auto;
    left: 15px;
}

.range-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.range-val {
    font-weight: 700;
    color: var(--c-primary);
    min-width: 80px;
}

/* Button */
.btn-calculate {
    width: 100%;
    padding: 14px;
    background: var(--c-primary);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
}

.btn-calculate:hover {
    background: var(--c-primary-hover);
    transform: translateY(-2px);
}

.btn-loader {
    display: none;
}

.btn-calculate.loading .btn-loader {
    display: block;
}

.btn-calculate.loading .btn-text {
    display: none;
}

/* Package Card Base */
.package-card {
    background: var(--bg-surface);
    border-radius: 24px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    display: flex;
    flex-direction: column;
}

.package-header {
    background: linear-gradient(135deg, var(--bg-body) 0%, var(--bg-surface) 100%);
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
}

.brand-logo img {
    height: 28px;
}

.package-badge {
    background: rgba(33, 150, 243, 0.1);
    color: var(--c-accent);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.package-content {
    padding: 25px;
}

.package-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 25px;
}

.specs-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.spec-icon {
    width: 45px;
    height: 45px;
    background: rgba(37, 58, 132, 0.05);
    color: var(--c-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-right: 15px;
}

[dir="rtl"] .spec-icon {
    margin-right: 0;
    margin-left: 15px;
}

.spec-details h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.spec-model {
    font-weight: 700;
    color: var(--text-main);
}

.spec-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.package-footer {
    margin-top: 25px;
    display: flex;
    justify-content: flex-end;
}

.btn-details {
    background: var(--text-main);
    color: var(--bg-surface);
    border: none;
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}

.empty-state-design {
    text-align: center;
    padding: 50px 30px;
    background: var(--bg-surface);
    border-radius: 24px;
    border: 2px dashed var(--border-subtle);
}

.info-note {
    background: rgba(37, 58, 132, 0.05);
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--c-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(37, 58, 132, 0.1);
}

/* Result Card Enhancements */
.result-breakdown-card {
    max-width: 600px;
}

.spec-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px;
}

.spec-details {
    flex: 1;
}

.spec-price {
    font-weight: 800;
    color: var(--text-main);
    font-size: 1.1rem;
    padding-left: 15px;
}

[dir="rtl"] .spec-price {
    padding-left: 0;
    padding-right: 15px;
}

.warranty-badge {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 5px;
    font-weight: 600;
}

/* Summary Section */
.result-summary {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px dashed var(--border-subtle);
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.summary-line.total {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-body);
    border-radius: 16px;
    color: var(--text-main);
    align-items: center;
}

.total-values {
    text-align: right;
}

[dir="rtl"] .total-values {
    text-align: left;
}

.iqd-large {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--c-primary);
    line-height: 1;
}

.usd-small {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-top: 5px;
}

.approx-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 15px;
    text-align: center;
    font-style: italic;
}

/* Comparison View */
.offers-container {
    background: var(--bg-surface);
    border-radius: 24px;
    padding: 30px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-medium);
    margin-bottom: 30px;
}

.comparison-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 25px;
    color: var(--text-main);
}

.brand-offers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.brand-preview-card {
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-body);
}

.brand-preview-card.motooma-theme:hover {
    border-color: var(--c-primary);
    transform: translateY(-5px);
}

.brand-preview-card.dia-theme:hover {
    border-color: #f48225;
    transform: translateY(-5px);
}

.brand-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.brand-mini-logo {
    height: 18px;
    opacity: 0.7;
}

.brand-tag {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 50px;
}

.motooma-theme .brand-tag {
    background: #e8eaf6;
    color: var(--c-primary);
}

.dia-theme .brand-tag {
    background: #fff3e0;
    color: #e65100;
}

.brand-preview-card h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.preview-price {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-main);
}

.preview-price small {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-show-more {
    width: 100%;
    background: none;
    border: 2px solid var(--border-subtle);
    padding: 12px;
    border-radius: 12px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
}

.btn-show-more:hover {
    background: var(--bg-body);
    color: var(--c-primary);
    border-color: var(--c-primary);
}

/* Technical Details */
.technical-details {
    animation: slideDown 0.4s ease-out;
}

.details-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.details-logo {
    height: 25px;
}

.spec-price-iqd {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-main);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 600px) {
    .brand-offers-grid {
        grid-template-columns: 1fr;
    }
}

/* Technical Details Grid */
.technical-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.comparison-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.brand-preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    transition: transform 0.3s ease;
}

.brand-preview-card:hover {
    transform: translateY(-5px);
}

.card-brand-logo {
    height: 20px;
}

.brand-name {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.spec-val-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

[dir="rtl"] .spec-val-box {
    align-items: flex-start;
}

.spec-item-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.spec-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.spec-label i {
    width: 20px;
    color: var(--c-primary);
}

.spec-val {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
    text-align: right;
}

[dir="rtl"] .spec-val {
    text-align: left;
}

.price-summary-box {
    margin-top: auto;
    padding-top: 20px;
    text-align: center;
}

.total-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 5px;
}

.total-amount {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--c-primary);
}

.warranty-summary {
    font-size: 0.75rem;
    color: #1976d2;
    font-weight: 700;
    margin-top: 10px;
    background: #e3f2fd;
    padding: 4px;
    border-radius: 6px;
}

/* Brand specific styling */
.motooma-style {
    border-top: 4px solid var(--c-primary);
}

.dia-style {
    border-top: 4px solid #f48225;
}

@media (max-width: 800px) {
    .technical-details-grid {
        grid-template-columns: 1fr;
    }
}

/* Logo Visibility */
.theme-dark-logo {
    display: none;
}

.theme-light-logo {
    display: block;
}

[data-theme="dark"] .theme-light-logo {
    display: none;
}

[data-theme="dark"] .theme-dark-logo {
    display: block;
}

[data-theme="dark"] .card-brand-logo {
    filter: none !important;
}

/* ROI Comparison Card */
.roi-comparison-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 25px;
    color: var(--text-main);
    margin-top: 25px;
    box-shadow: var(--shadow-small);
}

[data-theme="dark"] .roi-comparison-card {
    background: linear-gradient(135deg, #1a237e, #0d47a1);
    color: white;
    box-shadow: 0 10px 30px rgba(13, 71, 161, 0.3);
}

.roi-header {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 15px;
}

[data-theme="dark"] .roi-header {
    border-color: rgba(255, 255, 255, 0.1);
}

.roi-icon {
    width: 50px;
    height: 50px;
    background: var(--bg-body);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--c-primary);
}

[data-theme="dark"] .roi-icon {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.roi-titles h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
}

.roi-titles p {
    margin: 5px 0 0;
    font-size: 0.85rem;
    opacity: 0.8;
}

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

.roi-stat {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 15px;
    text-align: center;
}

.roi-stat.highlight {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.roi-label {
    display: block;
    font-size: 0.75rem;
    opacity: 0.7;
    margin-bottom: 5px;
}

.roi-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 900;
}

.text-red {
    color: #ff5252;
}

.roi-footer {
    margin-top: 20px;
    font-size: 0.8rem;
    opacity: 0.7;
    text-align: center;
    font-style: italic;
}

.optional-section {
    padding-top: 15px;
    margin-top: 15px;
    border-top: 1px dashed var(--border-subtle);
}

.empty-icon-3d {
    font-size: 4rem;
    color: var(--border-subtle);
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 900px) {
    .design-content-grid {
        grid-template-columns: 1fr;
    }

    .design-result-area {
        position: static;
        margin-top: 30px;
    }
}

@media (max-width: 600px) {
    .form-row-design {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .iqd-large {
        font-size: 1.5rem;
    }
}

/* AI Assistant Floating Button */
.ai-consultation-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

[dir="rtl"] .ai-consultation-launcher {
    right: auto;
    left: 30px;
}

.btn-ai-launch {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 15px rgba(46, 125, 50, 0.1);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: visible;
}

.btn-ai-launch:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(46, 125, 50, 0.15);
}

.btn-ai-launch i {
    animation: shake-head 2.5s infinite;
    font-size: 1.3rem;
    transform-origin: bottom center;
}

@keyframes shake-head {

    0%,
    100% {
        transform: rotate(0deg);
    }

    5% {
        transform: rotate(15deg);
    }

    10% {
        transform: rotate(-15deg);
    }

    15% {
        transform: rotate(10deg);
    }

    20% {
        transform: rotate(-10deg);
    }

    25% {
        transform: rotate(0deg);
    }
}

.btn-ai-dismiss {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: #ff5252;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 10;
    transition: all 0.2s;
}

[dir="rtl"] .btn-ai-dismiss {
    right: auto;
    left: -10px;
}

.btn-ai-dismiss:hover {
    background: #ff1744;
    transform: scale(1.1);
}

.pulse-ring {
    display: none;
}

/* AI Chat Window */
.ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    height: 600px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    display: none;
    flex-direction: column;
    z-index: 1001;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
}

[dir="rtl"] .ai-chat-window {
    right: auto;
    left: 30px;
}

.ai-chat-header {
    background: var(--c-primary);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-header h3 {
    margin: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-chat {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.8;
}

.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: var(--bg-body);
}

.chat-bubble {
    max-width: 85%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    animation: bubble-fade 0.3s ease forwards;
}

@keyframes bubble-fade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bubble-ai {
    align-self: flex-start;
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    border-bottom-left-radius: 4px;
}

.bubble-user {
    align-self: flex-end;
    background: var(--c-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-chat-input-area {
    padding: 20px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 10px;
}

.ai-chat-input-area input {
    flex: 1;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px 15px;
    background: var(--bg-body);
    color: var(--text-main);
    outline: none;
    font-size: 0.9rem;
}

.ai-chat-input-area button {
    background: var(--c-primary);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-input-area button:hover {
    background: var(--c-accent);
}

@media (max-width: 500px) {
    .ai-consultation-launcher {
        bottom: 105px;
        /* Above the 20px + 65px bottom nav */
        top: auto;
        right: 15px;
        transform: none;
        z-index: 1002;
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    [dir="rtl"] .ai-consultation-launcher {
        left: 15px;
        right: auto;
    }

    .btn-ai-launch {
        width: auto;
        height: auto;
        padding: 14px 20px;
        border-radius: 100px;
        display: flex;
        align-items: center;
        gap: 8px;
        box-shadow: 0 8px 20px rgba(46, 125, 50, 0.1);
        background: #e8f5e9;
        color: #2e7d32;
        border: 1px solid #c8e6c9;
    }

    .btn-ai-launch span {
        display: block !important;
        font-size: 0.85rem;
        font-weight: 800;
        white-space: nowrap;
    }

    .btn-ai-launch i {
        font-size: 1.2rem;
        margin: 0;
    }

    .pulse-ring {
        border-radius: 100px;
    }

    .btn-ai-dismiss {
        top: -12px;
        right: -8px;
        width: 22px;
        height: 22px;
        font-size: 8px;
        background: #ff5252;
        border: 2px solid white;
    }

    [dir="rtl"] .btn-ai-dismiss {
        left: -8px;
        right: auto;
    }

    .ai-chat-window {
        width: calc(100vw - 30px);
        height: 60vh;
        bottom: 170px;
        top: auto;
        right: 15px;
        border-radius: 24px;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    }

    [dir="rtl"] .ai-chat-window {
        left: 15px;
        right: auto;
    }
}

.chat-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.btn-option {
    background: var(--bg-body);
    border: 1px solid var(--border-subtle);
    padding: 10px 15px;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: right;
}

[dir="ltr"] .btn-option {
    text-align: left;
}

.btn-option:hover {
    background: var(--c-primary);
    color: white;
    border-color: var(--c-primary);
}