/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --primary-light: #818CF8;
    --twitter: #1DA1F2;
    --linkedin: #0A66C2;
    --newsletter: #7C3AED;
    --instagram-start: #F58529;
    --instagram-mid: #DD2A7B;
    --instagram-end: #8134AF;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --success: #10B981;
    --error: #EF4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.tagline {
    color: var(--gray-500);
    font-size: 1.125rem;
    margin-top: 0.5rem;
}

/* Input Section */
.input-section {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 2rem;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.input-header label {
    font-weight: 600;
    color: var(--gray-700);
}

.counter {
    font-size: 0.875rem;
    color: var(--gray-400);
}

textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 150px;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea::placeholder {
    color: var(--gray-400);
}

/* Transform Button */
.transform-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 1rem 2rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.transform-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

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

.transform-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.transform-btn.loading {
    pointer-events: none;
}

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

.transform-btn.loading .spinner {
    display: block !important;
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Output Section */
.output-section {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
    overflow-x: auto;
}

.tab {
    flex: 1;
    padding: 1rem 0.5rem;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    white-space: nowrap;
}

.tab:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

.tab.active {
    color: var(--gray-800);
    background: white;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.tab[data-platform="twitter"].active::after {
    background: var(--twitter);
}

.tab[data-platform="linkedin"].active::after {
    background: var(--linkedin);
}

.tab[data-platform="newsletter"].active::after {
    background: var(--newsletter);
}

.tab[data-platform="instagram"].active::after {
    background: linear-gradient(45deg, var(--instagram-start), var(--instagram-mid), var(--instagram-end));
}

/* Tab Icons */
.tab-icon {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.twitter-icon {
    background: var(--twitter);
}

.linkedin-icon {
    background: var(--linkedin);
}

.newsletter-icon {
    background: var(--newsletter);
}

.instagram-icon {
    background: linear-gradient(45deg, var(--instagram-start), var(--instagram-mid), var(--instagram-end));
}

/* Tab Content */
.tab-content {
    padding: 1.5rem;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.panel-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-700);
}

/* Copy Button */
.copy-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    background: white;
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.copy-btn.copied {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

/* Content Output */
.content-output {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 0.75rem;
    padding: 1rem;
    min-height: 150px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--gray-700);
}

/* Twitter Thread Styling */
.twitter-thread .tweet {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.twitter-thread .tweet:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 1.5rem;
    bottom: -0.75rem;
    width: 2px;
    height: 0.75rem;
    background: var(--gray-200);
}

.twitter-thread .tweet-number {
    font-size: 0.75rem;
    color: var(--twitter);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.twitter-thread .tweet-text {
    color: var(--gray-800);
}

/* Error Message */
.error-message {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 0.75rem;
    padding: 1rem;
    color: var(--error);
    margin-top: 1rem;
    text-align: center;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--gray-400);
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .input-section,
    .output-section {
        border-radius: 0.75rem;
    }

    .input-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        padding: 0.875rem 0.75rem;
        font-size: 0.8125rem;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .copy-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Loading State for Content */
.content-output.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
}

.content-output.loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
