/**
 * ============================================================================
 * UGC Styles for TextGenerator.net
 * ============================================================================
 * 
 * Styles for User-Generated Content pages:
 * - Font Creator (/font/create)
 * - Individual Font pages (/font/{slug})
 * - Browse Fonts (/fonts)
 * 
 * These styles complement your existing styles.css
 * 
 * @author Claude (built for Sebastian G.)
 * @version 1.0.0
 * ============================================================================
 */

/* ==========================================================================
   CSS VARIABLES (extend your existing color scheme)
   ========================================================================== */

:root {
    --ugc-primary: #2E7D32;
    --ugc-primary-hover: #1B5E20;
    --ugc-secondary: #1565C0;
    --ugc-secondary-hover: #0D47A1;
    --ugc-dark: #111;
    --ugc-light: #f5f5f5;
    --ugc-border: #ddd;
    --ugc-text: #333;
    --ugc-text-light: #666;
    --ugc-success: #2E7D32;
    --ugc-error: #f44336;
    --ugc-warning: #ff9800;
    --ugc-radius: 8px;
    --ugc-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --ugc-shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

/* ==========================================================================
   HERO SECTION ADJUSTMENTS
   ========================================================================== */

#hero {
    background: #111 !important;
    position: relative;
}

#hero:after {
    content: '';
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background-image: url(../img/hero.svg);
    background-position: bottom left;
    background-size: 100% 100%;
}

#hero .container {
    position: relative;
    z-index: 1;
}

#hero h1 {
    color: #fff !important;
    font-size: 36px;
    line-height: 1.3;
    margin: 0;
}

#hero .breadcrumbs {
    font-size: 14px;
    margin-bottom: 15px;
    opacity: 0.8;
    color: #fff;
}

#hero .breadcrumbs a {
    color: #fff;
    text-decoration: none;
}

#hero .breadcrumbs a:hover {
    text-decoration: underline;
}

.hero-subtitle {
    font-size: 18px;
    opacity: 1;
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.85);
}

/* Space between subtitle and wave SVG */
#hero p {
    padding-bottom: 65px;
}

/* ==========================================================================
   FORM INPUTS
   ========================================================================== */

textarea,
input[type="text"],
input[type="search"] {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--ugc-border);
    border-radius: var(--ugc-radius);
    font-size: 16px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
    color: var(--ugc-text);
}

textarea:focus,
input[type="text"]:focus,
input[type="search"]:focus {
    outline: none;
    border-color: var(--ugc-primary);
    box-shadow: 0 0 0 3px rgba(67, 160, 71, 0.15);
}

textarea {
    min-height: 150px;
}

textarea[readonly] {
    background: #f9f9f9;
    cursor: default;
}

select {
    padding: 10px 35px 10px 15px;
    border: 2px solid var(--ugc-border);
    border-radius: var(--ugc-radius);
    font-size: 14px;
    font-family: inherit;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--ugc-primary);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: var(--ugc-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-primary {
    background: var(--ugc-primary);
    color: white;
}

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

.btn-secondary {
    background: var(--ugc-secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--ugc-secondary-hover);
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

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

/* Button Row Layout */
.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.btn-row .btn {
    flex: 1;
    min-width: 100px;
}

/* Button Colors */
.green-btn {
    background: #2E7D32 !important;
    color: #fff !important;
    border: none !important;
}

.green-btn:hover {
    background: #1B5E20 !important;
}

.blue-btn {
    background: #2196F3 !important;
    color: #fff !important;
    border: none !important;
}

.blue-btn:hover {
    background: #42A5F5 !important;
}

.copy-btn {
    background: #9C27B0 !important;
    color: #fff !important;
    border: none !important;
}

.copy-btn:hover {
    background: #AB47BC !important;
}

/* ==========================================================================
   FORMS
   ========================================================================== */

.form-input,
.form-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid var(--ugc-border);
    border-radius: var(--ugc-radius);
    background: white;
    transition: border-color 0.2s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--ugc-primary);
}

.form-input::placeholder {
    color: #999;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--ugc-text);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--ugc-text-light);
}

/* Textarea styles */
.form-textarea {
    resize: vertical;
    min-height: 80px;
    max-height: 200px;
    font-family: inherit;
    line-height: 1.5;
}

.textarea-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

.textarea-footer small {
    margin-top: 0;
}

.char-counter {
    font-size: 12px;
    color: var(--ugc-text-light);
    font-weight: 500;
}

.char-counter.warning {
    color: #ff9800;
}

.char-counter.limit {
    color: var(--ugc-error);
}

.char-counter.too-short {
    color: var(--ugc-error);
}

.char-counter.too-short::after {
    content: ' (need 100+ chars & 10+ words)';
    font-size: 10px;
}

.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.form-errors {
    background: #ffebee;
    color: var(--ugc-error);
    padding: 12px 16px;
    border-radius: var(--ugc-radius);
    margin-top: 15px;
    font-weight: 500;
}

/* Name availability status */
.name-status {
    font-size: 13px;
    font-weight: 500;
    margin-top: 0;
    height: 0;
    overflow: hidden;
    transition: height 0.2s, margin-top 0.2s;
}

.name-status.checking,
.name-status.available,
.name-status.unavailable {
    height: auto;
    margin-top: 6px;
}

.name-status.checking {
    color: #666;
}

.name-status.checking::before {
    content: '⏳ ';
}

.name-status.available {
    color: var(--ugc-success);
}

.name-status.available::before {
    content: '✓ ';
}

.name-status.unavailable {
    color: var(--ugc-error);
}

.name-status.unavailable::before {
    content: '✗ ';
}

/* Input state when name is unavailable */
.form-input.input-error {
    border-color: var(--ugc-error) !important;
    background: #fff5f5;
}

.form-input.input-success {
    border-color: var(--ugc-success) !important;
}

.required {
    color: var(--ugc-error);
}

.form-actions {
    margin-top: 30px;
    text-align: center;
}

/* ==========================================================================
   STYLE CREATOR
   ========================================================================== */

.ugc-creator {
    display: block;
}

/* Hide the old preview section completely */
.ugc-creator .preview-section {
    display: none;
}

/* ==========================================================================
   FLOATING PREVIEW BAR
   Mobile: Always visible at BOTTOM
   Desktop: Hidden by default, appears at TOP when scrolled (JS controlled)
   ========================================================================== */

/* Base styles for preview bar */
.mobile-preview-bar {
    align-items: center;
    gap: 15px;
    position: fixed;
    left: 0;
    right: 0;
    background: white;
    padding: 12px 25px;
    z-index: 10000;
}

.mobile-preview-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--ugc-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    flex: 0 0 auto;
}

.mobile-preview-text {
    flex: 1 1 auto;
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ugc-text);
    text-align: center;
    min-width: 0;
}

.mobile-preview-bar .btn {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: auto !important;
    padding: 8px 20px !important;
    font-size: 13px !important;
}

/* MOBILE: Preview bar at BOTTOM, always visible */
@media (max-width: 768px) {
    .mobile-preview-bar {
        display: flex; /* Always visible on mobile */
        bottom: 0;
        top: auto;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
        border-top: 1px solid var(--ugc-border);
        border-bottom: none;
        padding: 10px 15px;
        gap: 10px;
    }
    
    .mobile-preview-text {
        font-size: 15px;
    }
    
    .mobile-preview-bar .btn {
        padding: 6px 14px !important;
        font-size: 12px !important;
    }
    
    /* Add padding at bottom so content isn't hidden behind the bar */
    #style-creator {
        padding-bottom: 70px;
    }
    
    /* No header swap on mobile */
    #header.header-hidden {
        transform: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
}

/* DESKTOP: Preview bar at TOP, hidden by default, JS controlled */
@media (min-width: 769px) {
    .mobile-preview-bar {
        display: none; /* Hidden by default on desktop */
        top: 0;
        bottom: auto;
        box-shadow: 0 4px 20px rgba(0,0,0,0.1);
        border-bottom: 1px solid var(--ugc-border);
        border-top: none;
        justify-content: center; /* Center the group */
    }
    
    .mobile-preview-bar.visible {
        display: flex; /* JS adds this class when scrolled */
    }
    
    /* Desktop: Preview text doesn't expand, stays with group */
    .mobile-preview-bar .mobile-preview-text {
        flex: 0 1 auto; /* Don't grow, can shrink, auto width */
        max-width: 60%; /* Limit max width for very long text */
        text-align: center;
    }
    
    /* Desktop: Keep label and button tight with text */
    .mobile-preview-bar .mobile-preview-label {
        flex: 0 0 auto;
    }
    
    .mobile-preview-bar .btn {
        flex: 0 0 auto !important;
    }
    
    /* Header hidden state - desktop only */
    #header.header-hidden {
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
    }
    
    /* When preview bar is visible, add top padding to main content */
    body.preview-bar-active #main {
        padding-top: 60px;
    }
    
    #style-creator {
        padding-bottom: 20px;
    }
}

.form-sections {
    background: white;
    padding: 40px;
    border-radius: var(--ugc-radius);
    box-shadow: var(--ugc-shadow);
}

.form-section {
    margin-bottom: 40px;
    padding-bottom: 35px;
    border-bottom: 1px solid var(--ugc-border);
}

.form-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.form-section h2 {
    font-size: 20px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--ugc-primary);
    color: white;
    border-radius: 50%;
    font-size: 15px;
    font-weight: 700;
}

@media (max-width: 768px) {
    .form-sections {
        padding: 25px 20px;
    }
    
    .form-section h2 {
        font-size: 18px;
    }
    
    .step-number {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}

.preview-box {
    background: white;
    padding: 25px;
    border-radius: var(--ugc-radius);
    box-shadow: var(--ugc-shadow);
    text-align: center;
}

.preview-box label {
    display: block;
    font-size: 13px;
    color: var(--ugc-text-light);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.preview-output {
    font-size: 24px;
    line-height: 1.5;
    word-break: break-word;
    padding: 20px;
    background: var(--ugc-light);
    border-radius: var(--ugc-radius);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-box .btn {
    margin-top: 15px;
}

/* Font Grid */
.font-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    max-height: 450px;
    overflow-y: auto;
    padding: 5px;
}

.font-option {
    display: block;
    padding: 12px;
    background: var(--ugc-light);
    border: 2px solid transparent;
    border-radius: var(--ugc-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.font-option:hover {
    background: white;
    border-color: var(--ugc-border);
}

.font-option.selected {
    background: white;
    border-color: var(--ugc-primary);
}

.font-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.font-name {
    display: block;
    font-size: 12px;
    color: var(--ugc-text-light);
    margin-bottom: 5px;
}

.font-example {
    display: block;
    font-size: 16px;
    color: var(--ugc-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   INDIVIDUAL STYLE PAGE
   ========================================================================== */

.style-info-card {
    background: white;
    padding: 30px;
    border-radius: var(--ugc-radius);
    box-shadow: var(--ugc-shadow);
    margin-bottom: 30px;
}

.style-info-card h2 {
    margin-bottom: 20px;
    font-size: 20px;
}

.style-description {
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--ugc-radius);
    border-left: 4px solid var(--ugc-primary);
}

.style-description p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: var(--ugc-text);
    font-style: italic;
}

/* Example Output Section */
.example-output-section {
    background: #fff;
    border: 2px solid #e8e8e8;
    border-radius: var(--ugc-radius);
    padding: 20px 25px;
}

.example-output-section label {
    display: block;
    font-size: 13px;
    color: var(--ugc-text-light);
    margin-bottom: 12px;
    font-weight: 500;
}

.example-output-section .example-text {
    font-size: 24px;
    padding: 0;
    background: transparent;
    word-break: break-word;
    line-height: 1.4;
}

/* Style example within info card */
.style-example {
    margin-bottom: 25px;
}

.style-example label {
    display: block;
    font-size: 13px;
    color: var(--ugc-text-light);
    margin-bottom: 10px;
}

.example-text {
    font-size: 22px;
    padding: 20px;
    background: var(--ugc-light);
    border-radius: var(--ugc-radius);
    word-break: break-word;
}

.style-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

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

.meta-item strong {
    color: var(--ugc-text-light);
    font-weight: 500;
}

.category-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--ugc-light);
    border-radius: 20px;
    font-size: 13px;
    color: var(--ugc-text);
    text-decoration: none;
}

.category-badge:hover {
    background: var(--ugc-border);
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    background: var(--ugc-light);
    border-radius: 4px;
    font-size: 13px;
    color: var(--ugc-text);
    text-decoration: none;
}

.tag:hover {
    background: var(--ugc-primary);
    color: white;
}

/* CTA Box */
.cta-box {
    background: linear-gradient(135deg, var(--ugc-primary), var(--ugc-secondary));
    color: white;
    padding: 40px;
    border-radius: var(--ugc-radius);
    text-align: center;
}

.cta-box h3 {
    font-size: 24px;
    margin-bottom: 10px;
}

.cta-box p {
    opacity: 0.9;
    margin-bottom: 20px;
}

.cta-box .btn {
    background: white;
    color: var(--ugc-primary);
}

.cta-box .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ==========================================================================
   BROWSE STYLES PAGE
   ========================================================================== */

.filters-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    padding: 15px 20px;
    background: white;
    border-radius: var(--ugc-radius);
    box-shadow: var(--ugc-shadow);
}

/* Search Box - clean icon-based design */
.search-box {
    position: relative;
    display: flex;
    flex: 1;
    min-width: 200px;
    max-width: 350px;
}

.search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #888;
    pointer-events: none;
    z-index: 1;
}

.search-box .search-icon circle,
.search-box .search-icon path {
    stroke: #888;
}

.search-box input {
    flex: 1;
    width: 100%;
    padding: 10px 45px 10px 40px;
    border: 2px solid var(--ugc-border);
    border-radius: var(--ugc-radius);
    font-size: 14px;
    background: #fff;
    color: var(--ugc-text);
    box-sizing: border-box;
}

.search-box input:focus {
    outline: none;
    border-color: var(--ugc-primary);
}

.search-box input::placeholder {
    color: #999;
}

.search-box .search-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: none;
    background: var(--ugc-primary);
    border-radius: var(--ugc-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.search-box .search-btn:hover {
    background: var(--ugc-primary-hover);
    transform: translateY(-50%) scale(1.05);
}

.search-box .search-btn svg {
    width: 16px;
    height: 16px;
    stroke: white;
}

/* Sort Dropdown */
.sort-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-dropdown label {
    font-size: 14px;
    color: var(--ugc-text-light);
    white-space: nowrap;
}

.sort-dropdown select {
    padding: 10px 12px;
    border: 2px solid var(--ugc-border);
    border-radius: var(--ugc-radius);
    font-size: 14px;
    background: white;
    min-width: 130px;
    cursor: pointer;
}

.sort-dropdown select:focus {
    outline: none;
    border-color: var(--ugc-primary);
}

/* Category Tabs */
.category-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--ugc-border);
}

.category-tab {
    padding: 8px 16px;
    background: var(--ugc-light);
    border-radius: 20px;
    font-size: 14px;
    color: var(--ugc-text);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.category-tab:hover {
    background: var(--ugc-border);
}

.category-tab.active {
    background: var(--ugc-primary);
    color: white;
}

/* Styles Grid */
.styles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.style-card {
    background: white;
    border-radius: var(--ugc-radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--ugc-shadow);
    transition: all 0.2s ease;
}

.style-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ugc-shadow-hover);
}

.style-card-preview {
    padding: 20px;
    background: var(--ugc-light);
    font-size: 20px;
    text-align: center;
    min-height: 80px;
    box-sizing: border-box;
    line-height: 1.4;
    word-break: break-word;
    display: flex;
    align-items: center;
    justify-content: center;
}

.style-card-info {
    padding: 15px 20px;
}

.style-card-info h2 {
    font-size: 16px;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.style-card-creator {
    font-size: 13px;
    color: var(--ugc-text-light);
    margin-bottom: 10px;
}

.style-card-stats {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: var(--ugc-text-light);
}

.style-card-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: var(--ugc-radius);
}

.no-results h2 {
    margin-bottom: 10px;
}

.no-results p {
    color: var(--ugc-text-light);
    margin-bottom: 20px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}

.pagination-btn {
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--ugc-border);
    border-radius: var(--ugc-radius);
    text-decoration: none;
    color: var(--ugc-text);
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination-btn:hover {
    border-color: var(--ugc-primary);
    color: var(--ugc-primary);
}

.pagination-info {
    color: var(--ugc-text-light);
}

/* CTA Section */
.cta-section {
    text-align: center;
    padding: 50px 20px;
    margin-top: 50px;
    background: var(--ugc-light);
    border-radius: var(--ugc-radius);
}

.cta-section h2 {
    margin-bottom: 10px;
}

.cta-section p {
    color: var(--ugc-text-light);
    margin-bottom: 25px;
}

/* ==========================================================================
   MODAL
   ========================================================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001; /* Higher than preview bar (10000) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
}

.modal-content {
    position: relative;
    background: white;
    padding: 40px;
    border-radius: var(--ugc-radius);
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    overflow: visible !important;
}

/* Override global button { width: 100% } for modal */
.modal-content button,
.modal-content .btn {
    width: auto;
}

.modal-content h2 {
    margin-bottom: 15px;
}

.modal-content p {
    color: var(--ugc-text-light);
    margin-bottom: 25px;
}

.share-url-box {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    align-items: stretch;
}

.share-url-box input,
.share-url-box input[type="text"],
.share-url-box .form-input,
#share-url {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    padding: 12px 15px !important;
    border: 2px solid var(--ugc-border) !important;
    border-radius: var(--ugc-radius) !important;
    font-size: 14px !important;
    background: #f5f5f5 !important;
    color: var(--ugc-text) !important;
    box-sizing: border-box !important;
}

.share-url-box .btn,
.share-url-box button,
#copy-url-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: auto !important;
    white-space: nowrap !important;
    padding: 12px 20px !important;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-actions .btn,
.modal-actions button,
.modal-actions a.btn,
#view-style-btn,
#create-another-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: auto !important;
    padding: 12px 24px !important;
}

/* ==========================================================================
   SHARE BUTTON
   ========================================================================== */

.btn--share,
.share-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.btn--share:hover,
.share-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-1px);
}

.share-icon {
    display: inline-block;
    margin-right: 4px;
}

/* ==========================================================================
   SHARE MODAL
   ========================================================================== */

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 5px 10px;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

/* ==========================================================================
   SOCIAL SHARE BUTTONS
   ========================================================================== */

.social-share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 25px 0;
}

.social-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.social-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.social-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.social-label {
    font-size: 11px;
    font-weight: 500;
}

/* Twitter/X */
.social-btn--twitter {
    background: #000;
    color: white;
}

.social-btn--twitter:hover {
    background: #333;
}

/* Facebook */
.social-btn--facebook {
    background: #1877f2;
    color: white;
}

.social-btn--facebook .social-icon {
    font-family: Georgia, serif;
    font-weight: bold;
    font-size: 28px;
}

.social-btn--facebook:hover {
    background: #166fe5;
}

/* WhatsApp */
.social-btn--whatsapp {
    background: #25d366;
    color: white;
}

.social-btn--whatsapp:hover {
    background: #22c55e;
}

/* Telegram */
.social-btn--telegram {
    background: #0088cc;
    color: white;
}

.social-btn--telegram:hover {
    background: #0077b5;
}

/* Reddit */
.social-btn--reddit {
    background: #ff4500;
    color: white;
}

.social-btn--reddit:hover {
    background: #e63e00;
}

/* Native Share (More) */
.social-btn--native {
    background: #6b7280;
    color: white;
}

.social-btn--native:hover {
    background: #4b5563;
}

/* Share Status */
.share-status {
    min-height: 1.5em;
    color: var(--ugc-success, #10b981);
    font-size: 14px;
    margin-top: 10px;
}

/* ==========================================================================
   EMOJI PICKER
   ========================================================================== */

.input-with-button {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.input-with-button .form-select {
    flex: 1;
    min-width: 0;
}

.btn-emoji-picker {
    flex: 0 0 auto !important;
    width: auto !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    background: var(--ugc-light) !important;
    border: 1px solid var(--ugc-border) !important;
    border-radius: var(--ugc-radius) !important;
    color: var(--ugc-text) !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    position: relative !important;
    z-index: 1 !important;
    pointer-events: auto !important;
}

.btn-emoji-picker:hover {
    background: var(--ugc-primary) !important;
    color: white !important;
    border-color: var(--ugc-primary) !important;
}

/* Emoji Picker Modal */
.emoji-picker-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 10001 !important; /* Higher than preview bar (10000) */
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
}

.emoji-picker-modal .modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
}

.emoji-picker-modal .modal-content,
.emoji-picker-content {
    position: relative !important;
    max-width: 420px !important;
    width: 90% !important;
    padding: 0 !important;
    background: white !important;
    border-radius: var(--ugc-radius) !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3) !important;
    z-index: 10002 !important; /* Higher than modal backdrop */
}

.emoji-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--ugc-border);
}

.emoji-picker-header h3 {
    margin: 0;
    font-size: 18px;
}

.emoji-picker-close {
    background: none !important;
    border: none !important;
    font-size: 28px !important;
    color: var(--ugc-text-light) !important;
    cursor: pointer !important;
    padding: 0 !important;
    width: auto !important;
    line-height: 1 !important;
}

.emoji-picker-close:hover {
    color: var(--ugc-text) !important;
}

.emoji-picker-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--ugc-light);
    font-size: 14px;
}

.emoji-picker-preview span:first-child {
    color: var(--ugc-text-light);
    flex-shrink: 0;
}

#emoji-preview-current {
    flex: 1;
    font-size: 18px;
    min-height: 24px;
    word-break: break-all;
}

#emoji-clear-btn {
    flex-shrink: 0 !important;
    width: auto !important;
    padding: 6px 12px !important;
    font-size: 12px !important;
}

.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.emoji-btn {
    width: 100% !important;
    aspect-ratio: 1;
    font-size: 22px !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.15s ease !important;
}

.emoji-btn:hover {
    background: var(--ugc-light) !important;
    border-color: var(--ugc-border) !important;
    transform: scale(1.15);
}

.emoji-picker-actions {
    padding: 15px 20px;
    border-top: 1px solid var(--ugc-border);
    text-align: right;
}

.emoji-picker-actions .btn {
    width: auto !important;
}

@media (max-width: 480px) {
    .emoji-picker-grid {
        grid-template-columns: repeat(8, 1fr);
    }
    
    .emoji-btn {
        font-size: 20px !important;
    }
    
    .input-with-button {
        flex-direction: column;
    }
    
    .btn-emoji-picker {
        width: 100% !important;
    }
}

/* ==========================================================================
   TIPS SECTION
   ========================================================================== */

.tips-section {
    margin-top: 50px;
    padding: 40px;
    background: var(--ugc-light);
    border-radius: var(--ugc-radius);
}

.tips-section h2 {
    text-align: center;
    margin-bottom: 30px;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
}

.tip {
    background: white;
    padding: 20px;
    border-radius: var(--ugc-radius);
}

.tip strong {
    display: block;
    margin-bottom: 8px;
    color: var(--ugc-primary);
}

.tip p {
    font-size: 14px;
    color: var(--ugc-text-light);
    margin: 0;
}

/* ==========================================================================
   LIKE BUTTON
   ========================================================================== */

.like-btn {
    background: #fff !important;
    border: 2px solid #e0e0e0 !important;
    color: #666 !important;
    transition: all 0.2s ease;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 12px 24px !important;
    font-size: 14px !important;
    min-width: 80px !important;
}

.like-btn:hover {
    border-color: #ff6b6b !important;
    color: #ff6b6b !important;
    background: #fff5f5 !important;
}

.like-btn.liked {
    background: #fff0f0 !important;
    border-color: #ff6b6b !important;
    color: #ff6b6b !important;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 15px;
    }
    
    .search-box {
        max-width: none;
        width: 100%;
    }
    
    .sort-dropdown {
        justify-content: space-between;
        width: 100%;
    }
    
    .sort-dropdown select {
        flex: 1;
    }
    
    .filters-bar > .btn {
        width: 100%;
        text-align: center;
    }
    
    .styles-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-row .form-group {
        min-width: auto;
    }
    
    .modal-content {
        padding: 25px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions .btn,
    .modal-actions button,
    .modal-actions a.btn {
        width: 100% !important;
        min-width: auto !important;
    }
    
    .share-url-box {
        flex-direction: column;
    }
    
    .share-url-box .btn,
    .share-url-box button {
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .category-tabs {
        justify-content: center;
    }
    
    .btn-row {
        flex-direction: column;
    }
    
    .btn-row .btn {
        flex: none;
        width: 100%;
    }
    
    #hero h1 {
        font-size: 28px;
    }
}

/* Generator page - stack textareas on tablet and below */
@media (max-width: 900px) {
    #main .row > .col6 {
        width: 100% !important;
        float: none !important;
        margin-bottom: 15px;
    }
    
    #main .row > .col6:last-child {
        margin-bottom: 0;
    }
}

/* ==========================================================================
   SCREEN READER ONLY
   ========================================================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   FINAL OVERRIDES - Override global button { width: 100% }
   ========================================================================== */

.modal button,
.modal .btn,
.modal-content button,
.modal-content .btn,
#success-modal button,
#success-modal .btn,
button#copy-url-btn,
button#create-another-btn,
button#preview-bar-copy {
    width: auto !important;
    flex: 0 0 auto !important;
}

.mobile-preview-bar button,
.mobile-preview-bar .btn {
    width: auto !important;
    flex: 0 0 auto !important;
}
