/* =============================================
   SIGMIX Resources - Widget Builder
   /css/resources.css v1.0
   ============================================= */

/* Hero */
.res-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #312e81 100%);
    color: #fff;
    padding: 2.5rem 0 2rem;
    position: relative;
    overflow: hidden;
}
.res-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
    pointer-events: none;
}
.res-breadcrumbs {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 1rem;
}
.res-breadcrumbs a {
    color: #94a3b8;
    text-decoration: none;
}
.res-breadcrumbs a:hover {
    color: #e2e8f0;
}
.res-sep {
    margin: 0 0.4rem;
    opacity: 0.5;
}
.res-hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    line-height: 1.2;
}
.res-hero-sub {
    color: #94a3b8;
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 0 1.5rem;
    line-height: 1.5;
}
.res-hero-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.res-hero-stat {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #cbd5e1;
}
.res-hero-stat strong {
    color: #a5b4fc;
    margin-right: 0.25rem;
}

/* Container */
.res-container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}

/* Widget Type Tabs */
.res-type-tabs {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}
.res-type-tab {
    padding: 0.6rem 1.1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
}
.res-type-tab:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #f5f3ff;
}
.res-type-tab.active {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}
.res-type-tab i { font-size: 0.9rem; }

/* Builder Layout */
.res-builder {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 840px) {
    .res-builder { grid-template-columns: 1fr; }
}

/* Options Panel */
.res-options {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    position: sticky;
    top: 80px;
}
.res-options h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.res-field {
    margin-bottom: 1rem;
}
.res-field label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.res-field input[type="text"],
.res-field select {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    font-size: 0.85rem;
    color: #1e293b;
    background: #f8fafc;
    transition: border-color 0.2s;
    font-family: inherit;
}
.res-field input:focus,
.res-field select:focus {
    outline: none;
    border-color: #6366f1;
    background: #fff;
}
.res-field-hint {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 0.2rem;
}
.res-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}
.res-color-input {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.res-color-input input[type="color"] {
    width: 32px;
    height: 32px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
    background: #f8fafc;
}
.res-color-hex {
    font-size: 0.75rem;
    color: #64748b;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Preview Area */
.res-preview-area {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.res-preview-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}
.res-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.res-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.res-preview-box {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    background: repeating-linear-gradient(
        45deg, transparent, transparent 10px,
        rgba(0,0,0,0.01) 10px, rgba(0,0,0,0.01) 20px
    );
}
.res-preview-box.dark-bg {
    background: #0f172a;
}

/* Code Output */
.res-code-box {
    background: #1e293b;
    border-radius: 0 0 12px 12px;
}
.res-code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background: #0f172a;
    border-top: 1px solid #334155;
}
.res-code-header span {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
}
.res-code-dots {
    display: flex;
    gap: 5px;
}
.res-code-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: block;
}
.res-code-dots span:nth-child(1) { background: #ef4444; }
.res-code-dots span:nth-child(2) { background: #eab308; }
.res-code-dots span:nth-child(3) { background: #22c55e; }
.res-copy-btn {
    background: #6366f1;
    color: #fff;
    border: none;
    padding: 0.35rem 0.9rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.res-copy-btn:hover { background: #4f46e5; }
.res-copy-btn.copied { background: #10b981; }
.res-code-body {
    padding: 1rem;
    overflow-x: auto;
    max-height: 220px;
    overflow-y: auto;
}
.res-code-body pre {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.6;
    color: #e2e8f0;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    white-space: pre-wrap;
    word-break: break-all;
}

/* =============================================
   WIDGET PREVIEW STYLES (mirrors embed output)
   ============================================= */
.smx-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    width: 100%;
    max-width: 500px;
    line-height: 1.4;
}

/* Ticker */
.smx-ticker {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.65rem 1rem;
}
.smx-ticker-symbol { font-weight: 700; font-size: 0.9rem; }
.smx-ticker-name { font-size: 0.75rem; opacity: 0.55; }
.smx-ticker-price { font-weight: 600; font-size: 0.9rem; margin-left: auto; }
.smx-ticker-change {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
}
.smx-up { color: #10b981; }
.smx-down { color: #ef4444; }
.smx-up-bg { background: rgba(16,185,129,0.1); color: #10b981; }
.smx-down-bg { background: rgba(239,68,68,0.1); color: #ef4444; }

/* Card */
.smx-card { padding: 1.1rem; }
.smx-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.6rem;
}
.smx-card-symbol { font-size: 1.05rem; font-weight: 700; }
.smx-card-name { font-size: 0.7rem; opacity: 0.5; margin-top: 0.1rem; }
.smx-card-sector {
    font-size: 0.6rem;
    opacity: 0.4;
    margin-top: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.smx-card-price { font-size: 1.4rem; font-weight: 700; }
.smx-card-change { font-size: 0.8rem; font-weight: 600; }
.smx-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.4rem;
    margin-top: 0.8rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(128,128,128,0.12);
}
.smx-card-stat-label {
    font-size: 0.6rem;
    opacity: 0.45;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.smx-card-stat-value { font-size: 0.8rem; font-weight: 600; margin-top: 0.05rem; }

/* Multi */
.smx-multi .smx-multi-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.9rem;
}
.smx-multi .smx-multi-row + .smx-multi-row {
    border-top: 1px solid rgba(128,128,128,0.08);
}
.smx-multi-sym { font-weight: 700; font-size: 0.8rem; width: 52px; }
.smx-multi-name { font-size: 0.7rem; opacity: 0.45; flex: 1; padding: 0 0.4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smx-multi-price { font-weight: 600; font-size: 0.8rem; text-align: right; width: 62px; }
.smx-multi-change { font-size: 0.75rem; font-weight: 600; text-align: right; width: 62px; }

/* Tape / Scrolling */
.smx-tape-track {
    display: flex;
    animation: smx-scroll var(--smx-speed, 20s) linear infinite;
    width: max-content;
}
.smx-tape-track:hover { animation-play-state: paused; }
@keyframes smx-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.smx-tape-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    white-space: nowrap;
    border-right: 1px solid rgba(128,128,128,0.08);
}
.smx-tape-sym { font-weight: 700; font-size: 0.8rem; }
.smx-tape-price { font-weight: 600; font-size: 0.8rem; }
.smx-tape-change { font-size: 0.75rem; font-weight: 600; }

/* Badge */
.smx-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.7rem;
}
.smx-badge-sym { font-weight: 700; font-size: 0.8rem; }
.smx-badge-price { font-weight: 600; font-size: 0.8rem; }
.smx-badge-change { font-size: 0.75rem; font-weight: 600; }

/* Credit link */
.smx-credit {
    display: block;
    text-align: right;
    padding: 0.25rem 0.65rem 0.4rem;
    font-size: 0.6rem;
    opacity: 0.4;
    text-decoration: none;
    transition: opacity 0.2s;
}
.smx-credit:hover { opacity: 0.7; }

/* =============================================
   INFO SECTION
   ============================================= */
.res-info {
    margin-top: 3rem;
}
.res-info-header {
    text-align: center;
    margin-bottom: 2rem;
}
.res-info-header h2 {
    font-size: 1.3rem;
    margin: 0 0 0.5rem;
    color: #1e293b;
}
.res-info-header p {
    color: #64748b;
    font-size: 0.95rem;
    max-width: 550px;
    margin: 0 auto;
}
.res-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}
.res-info-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    transition: border-color 0.2s;
}
.res-info-card:hover { border-color: #c7d2fe; }
.res-info-icon {
    width: 40px;
    height: 40px;
    background: #eef2ff;
    color: #6366f1;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-bottom: 0.75rem;
}
.res-info-card h4 {
    font-size: 0.9rem;
    margin: 0 0 0.3rem;
    color: #1e293b;
}
.res-info-card p {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* How-to */
.res-howto {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2.5rem;
}
.res-howto h3 {
    font-size: 1.1rem;
    margin: 0 0 1.5rem;
    color: #1e293b;
    text-align: center;
}
.res-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}
.res-step {
    text-align: center;
}
.res-step-num {
    width: 36px;
    height: 36px;
    background: #6366f1;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    margin: 0 auto 0.6rem;
}
.res-step h4 {
    font-size: 0.85rem;
    margin: 0 0 0.25rem;
    color: #1e293b;
}
.res-step p {
    font-size: 0.78rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* FAQ */
.res-faq {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 2rem;
}
.res-faq h3 {
    font-size: 1.1rem;
    margin: 0 0 1.25rem;
    color: #1e293b;
}
.res-faq-item {
    margin-bottom: 1rem;
}
.res-faq-item:last-child { margin-bottom: 0; }
.res-faq-q {
    font-weight: 600;
    font-size: 0.88rem;
    color: #1e293b;
    margin-bottom: 0.25rem;
}
.res-faq-a {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.6;
}

/* Mobile */
@media (max-width: 640px) {
    .res-hero h1 { font-size: 1.5rem; }
    .res-hero-stats { gap: 0.75rem; }
    .res-hero-stat { font-size: 0.78rem; padding: 0.4rem 0.75rem; }
    .res-type-tabs { gap: 0.4rem; }
    .res-type-tab { padding: 0.5rem 0.8rem; font-size: 0.78rem; }
    .res-field-row { grid-template-columns: 1fr; }
    .res-steps { grid-template-columns: 1fr; }
}

/* =============================================
   RTL / ARABIC OVERRIDES
   ============================================= */
[dir="rtl"] .res-breadcrumbs { direction: rtl; }
[dir="rtl"] .res-sep { margin: 0 0.4rem; }
[dir="rtl"] .res-hero-sub { text-align: right; }
[dir="rtl"] .res-hero-stats { justify-content: flex-start; }
[dir="rtl"] .res-hero-stat strong { margin-left: 0.25rem; margin-right: 0; }

[dir="rtl"] .res-type-tabs { direction: rtl; }
[dir="rtl"] .res-type-tab { flex-direction: row-reverse; }
[dir="rtl"] .res-type-tab i { margin-left: 0; }

[dir="rtl"] .res-builder {
    grid-template-columns: 1fr 300px;
}
@media (max-width: 840px) {
    [dir="rtl"] .res-builder { grid-template-columns: 1fr; }
}

[dir="rtl"] .res-options { direction: rtl; text-align: right; }
[dir="rtl"] .res-options h3 { flex-direction: row-reverse; justify-content: flex-end; }
[dir="rtl"] .res-field label { text-align: right; }
[dir="rtl"] .res-field input,
[dir="rtl"] .res-field select { text-align: right; direction: ltr; }
[dir="rtl"] .res-field-hint { text-align: right; }
[dir="rtl"] .res-color-input { flex-direction: row-reverse; }

[dir="rtl"] .res-section-header { flex-direction: row-reverse; }
[dir="rtl"] .res-section-label { flex-direction: row-reverse; }
[dir="rtl"] .res-code-header { flex-direction: row-reverse; }
[dir="rtl"] .res-copy-btn { flex-direction: row-reverse; }

[dir="rtl"] .res-preview-box { direction: ltr; }

[dir="rtl"] .res-howto { text-align: right; }
[dir="rtl"] .res-howto h3 { text-align: center; }
[dir="rtl"] .res-step { text-align: center; }

[dir="rtl"] .res-info-header { text-align: center; }
[dir="rtl"] .res-info-card { text-align: right; }
[dir="rtl"] .res-faq { text-align: right; }
[dir="rtl"] .res-faq-q { text-align: right; }
[dir="rtl"] .res-faq-a { text-align: right; }

[dir="rtl"] .smx-credit { text-align: left; }
