/* Tool Hero Section - Required by tool-page-structure.mdc */
.tool-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.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;
}

@media (max-width: 767px) {
    .hero-text h1 {
        font-size: clamp(1.75rem, 5vw, 2.5rem);
    }
    
    .hero-subtitle {
        font-size: clamp(1rem, 3vw, 1.125rem);
    }
}

/* Main Wrapper */
.url-encode-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

@media (min-width: 992px) {
    .url-encode-wrapper {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
}

/* Card Styles */
.encode-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.encode-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.output-card {
    border: 2px solid #e5e7eb;
}

.output-card.has-output {
    border-color: #10b981;
}

/* Card Header */
.card-header-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px;
    border-bottom: 1px solid #f3f4f6;
    gap: 16px;
    flex-wrap: wrap;
}

.header-content {
    flex: 1;
    min-width: 200px;
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.card-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

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

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.action-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #111827;
}

.action-btn:active {
    transform: scale(0.98);
}

.action-btn svg {
    flex-shrink: 0;
}

/* Input/Output Section */
.url-encode-wrapper .input-section,
.url-encode-wrapper .output-section {
    padding: 0 24px 20px;
}

/* Override common editor-container styles with higher specificity */
.url-encode-wrapper .editor-container {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    display: block !important;
    align-items: unset !important;
    justify-content: unset !important;
    min-height: auto !important;
    flex-direction: unset !important;
}

.url-encode-wrapper .editor-container .json-editor {
    width: 100% !important;
    min-height: 280px !important;
    max-width: 100% !important;
    padding: 16px !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    color: #111827 !important;
    background: #f9fafb !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 12px !important;
    resize: vertical !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
    display: block !important;
    margin: 0 !important;
}

.url-encode-wrapper .json-editor:focus {
    outline: none !important;
    border-color: #3b82f6 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.url-encode-wrapper .output-editor {
    background: #fef3c7 !important;
    border-color: #fbbf24 !important;
}

.url-encode-wrapper .output-editor:focus {
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1) !important;
}

/* Ensure textarea is visible and properly styled */
.url-encode-wrapper textarea.json-editor {
    opacity: 1 !important;
    visibility: visible !important;
    overflow: auto !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
}

/* Prevent any hidden or collapsed states */
.url-encode-wrapper .editor-container textarea {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.url-encode-wrapper .editor-status {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-top: 8px !important;
    font-size: 12px !important;
    width: 100% !important;
    position: relative !important;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #6b7280;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    display: inline-block;
}

.status-indicator.ready .status-dot {
    background: #10b981;
}

.status-indicator.error .status-dot {
    background: #ef4444;
}

.status-indicator.processing .status-dot {
    background: #3b82f6;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.char-count {
    color: #9ca3af;
    font-weight: 400;
}

/* Options Section */
.options-section {
    padding: 0 24px 20px;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 640px) {
    .options-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.option-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.option-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 5px;
    background: #ffffff;
    flex-shrink: 0;
    margin-top: 2px;
    position: relative;
    transition: all 0.2s ease;
}

.option-item input[type="checkbox"]:checked + .checkbox-custom {
    background: #3b82f6;
    border-color: #3b82f6;
}

.option-item input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.option-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.option-title {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

.option-desc {
    font-size: 12px;
    color: #6b7280;
}

/* Encode Button */
.encode-button-wrapper {
    padding: 0 24px 24px;
}

.encode-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
}

.encode-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

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

.encode-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.encode-btn svg {
    flex-shrink: 0;
}

/* Stats Section */
.stats-section {
    padding: 20px 24px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
    font-weight: 500;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

/* Info Section */
.info-section {
    margin-top: 32px;
    margin-bottom: 32px;
}

.info-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.info-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 16px 0;
}

.info-text {
    font-size: 16px;
    line-height: 1.6;
    color: #374151;
    margin: 0 0 24px 0;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 768px) {
    .info-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.info-block {
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.info-block-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 16px 0;
}

.encoding-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.encoding-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.encoding-item code {
    font-size: 13px;
    padding: 4px 8px;
    background: #f3f4f6;
    border-radius: 4px;
    color: #111827;
}

.arrow {
    color: #6b7280;
    font-weight: 500;
}

.use-case-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.use-case-list li {
    padding: 10px 12px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    font-size: 14px;
    color: #374151;
    position: relative;
    padding-left: 32px;
}

.use-case-list li::before {
    content: '✓';
    position: absolute;
    left: 12px;
    color: #10b981;
    font-weight: 600;
}

/* Mobile Optimizations */
@media (max-width: 767px) {
    .url-encode-wrapper {
        gap: 20px;
    }

    .url-encode-wrapper .card-header-section {
        padding: 16px 20px;
    }

    .url-encode-wrapper .card-title {
        font-size: 18px;
    }

    .url-encode-wrapper .card-subtitle {
        font-size: 13px;
    }

    .url-encode-wrapper .action-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .url-encode-wrapper .input-section,
    .url-encode-wrapper .output-section {
        padding: 0 20px 16px !important;
    }

    .url-encode-wrapper .editor-container {
        width: 100% !important;
        height: auto !important;
        display: block !important;
    }

    .url-encode-wrapper .json-editor {
        min-height: 240px !important;
        font-size: 13px !important;
        padding: 12px !important;
        width: 100% !important;
    }

    .options-section {
        padding: 0 20px 16px;
    }

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

    .encode-button-wrapper {
        padding: 0 20px 20px;
    }

    .encode-btn {
        padding: 12px 20px;
        font-size: 15px;
    }

    .stats-section {
        padding: 16px 20px;
    }

    .stats-grid {
        gap: 12px;
    }

    .stat-item {
        padding: 10px;
    }

    .stat-value {
        font-size: 16px;
    }

    .info-card {
        padding: 24px 20px;
    }

    .info-title {
        font-size: 20px;
    }

    .info-text {
        font-size: 15px;
    }

    .info-grid {
        gap: 20px;
    }

    .info-block {
        padding: 16px;
    }
}

/* Notification Toast */
.notification-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid #3b82f6;
}

.notification-toast.success {
    border-left-color: #10b981;
}

.notification-toast.error {
    border-left-color: #ef4444;
}

.notification-toast.info {
    border-left-color: #3b82f6;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

.notification-close {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.notification-close:hover {
    background: #f3f4f6;
    color: #111827;
}
