:root {
    --surface: #ffffff;
    --surface-muted: #f4f6fb;
    --border: #e3e8f2;
    --text-main: #1c2333;
    --text-muted: #5f6b85;
    --primary: #0d47fb;
    --primary-dark: #0a2fa3;
    --accent: #8b5cf6;
    --shadow-soft: 0 20px 45px rgba(15, 23, 42, 0.08);
    --gradient: linear-gradient(135deg, #0d47fb 0%, #8b5cf6 100%);
}

.tool-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.hero-text {
    flex: 1;
    min-width: 260px;
}

.hero-text h1 {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 640px;
    margin-bottom: 1rem;
    margin-top: 0;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    padding: 32px;
    height: 100%;
    transition: background 0.3s ease, border 0.3s ease;
}

.panel-head {
    margin-bottom: 24px;
}

.tool-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.textarea-wrapper {
    position: relative;
    margin-top: 20px;
}

.textarea-wrapper label {
    font-weight: 600;
    margin-bottom: 10px;
    display: block;
    color: var(--text-muted);
    font-size: 14px;
}

.text-input-modern {
    width: 100%;
    min-height: 200px;
    border-radius: 18px;
    border: 1px solid var(--border);
    padding: 24px;
    font-size: 15px;
    line-height: 1.7;
    background: var(--surface-muted);
    color: var(--text-main);
    transition: border 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    resize: vertical;
    
}

.text-input-modern:focus:not([readonly]) {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(13, 71, 251, 0.15);
}

.text-input-modern[readonly] {
    background: var(--surface-muted);
    cursor: default;
}

.controls-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.controls-section:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.radio-item input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

.radio-item label {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-main);
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--border);
    cursor: pointer;
    accent-color: var(--primary);
}

.checkbox-item label {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-main);
    cursor: pointer;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.control-group label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.control-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-main);
    font-size: 15px;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.control-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 71, 251, 0.1);
}

.action-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-top: 24px;
}

.btn-action-modern {
    border: none;
    border-radius: 14px;
    padding: 14px 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: inset 0 0 0 1px var(--border);
    background: var(--surface-muted);
    color: var(--text-main);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    cursor: pointer;
    font-size: 15px;
    flex: 1;
    min-width: 0;
}

.btn-action-modern.primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: var(--shadow-soft);
    border: none;
}

.btn-action-modern:hover {
    transform: translateY(-2px);
    background: rgba(13, 71, 251, 0.08);
    box-shadow: 0 4px 12px rgba(13, 71, 251, 0.15);
}

.btn-action-modern.primary:hover {
    background: var(--gradient);
    box-shadow: 0 6px 20px rgba(13, 71, 251, 0.25);
}

.output-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    font-size: 0.95rem;
}

.copy-btn:hover {
    background: rgba(13, 71, 251, 0.08);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.copy-btn[data-state="copied"] {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.4);
    color: #059669;
}

.preview-container {
    margin-top: 20px;
    margin-bottom: 20px;
}

.preview-label {
    font-weight: 600;
    margin-bottom: 10px;
    display: block;
    color: var(--text-muted);
    font-size: 14px;
}

.preview-wrapper {
    min-height: 200px;
    border-radius: 18px;
    border: 1px solid var(--border);
    padding: 24px;
    background: var(--surface-muted);
    position: relative;
    overflow: auto;
}

.preview-wrapper .text-muted {
    color: var(--text-muted);
    font-style: italic;
}

.sticky-panel {
    position: sticky;
    top: 90px;
}

.result-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.share-container {
    background: rgba(13, 71, 251, 0.08);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    border: 1px solid rgba(13, 71, 251, 0.2);
}

.share-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.share-btn {
    border: none;
    border-radius: 14px;
    padding: 12px 16px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.15);
    font-size: 14px;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 24px rgba(15, 23, 42, 0.18);
}

.share-btn i {
    font-size: 14px;
}

.share-x {
    background: #111827;
}

.share-facebook {
    background: #1877f2;
}

.share-linkedin {
    background: #0a66c2;
}

.share-reddit {
    background: #ff4500;
}

.share-telegram {
    background: #229ed9;
}

.share-whatsapp {
    background: #25d366;
    color: #0f172a;
}

/* Preview dialog styles */
.preview-wrapper dialog {
    padding: 0;
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background: white;
    max-width: 500px;
    min-width: 300px;
}

.preview-wrapper dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.preview-wrapper .dialog-trigger {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.preview-wrapper .dialog-trigger:hover {
    background: var(--primary-dark);
}

@media (max-width: 767px) {
    .tool-hero {
        flex-direction: column;
    }

    .hero-text h1 {
        font-size: clamp(1.75rem, 5vw, 2.5rem);
    }

    .hero-subtitle {
        font-size: clamp(1rem, 3vw, 1.125rem);
    }

    .panel {
        padding: 24px;
    }

    .text-input-modern {
        min-height: 180px;
        padding: 18px;
        font-size: 14px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .output-actions {
        flex-direction: column;
    }

    .copy-btn {
        width: 100%;
    }

    .share-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .sticky-panel {
        position: relative;
        top: 0;
    }

    .preview-wrapper {
        min-height: 150px;
        padding: 18px;
    }
}

