/* CSS Custom Properties for Library Theme */
:root {
    --primary-color: #8B4513;
    --secondary-color: #D2691E;
    --accent-color: #CD853F;
    --text-primary: #2C1810;
    --text-secondary: #5D4E37;
    --text-muted: #8B7355;
    --background-primary: #FFF8DC;
    --background-secondary: #F5DEB3;
    --background-paper: #FFFEF7;
    --border-color: #DEB887;
    --success-color: #228B22;
    --error-color: #B22222;
    --warning-color: #DAA520;
    
    --shadow-light: 0 2px 4px rgba(139, 69, 19, 0.1);
    --shadow-medium: 0 4px 12px rgba(139, 69, 19, 0.15);
    --shadow-heavy: 0 8px 24px rgba(139, 69, 19, 0.2);
    
    --border-radius: 8px;
    --border-radius-large: 12px;
    
    --font-serif: 'Playfair Display', serif;
    --font-body: 'Crimson Text', serif;

    /* Animation variables */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, var(--background-primary), var(--background-secondary));
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.library-container {
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--background-paper);
    box-shadow: var(--shadow-heavy);
}

/* Header Styles */
.library-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.library-title {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 0 0 5px rgba(255, 255, 255, 0.5); }
    to { text-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 30px rgba(205, 133, 63, 0.5); }
}

.library-title i {
    color: var(--accent-color);
    animation: bookFloat 2s ease-in-out infinite alternate;
}

@keyframes bookFloat {
    from { transform: translateY(0px) rotate(0deg); }
    to { transform: translateY(-3px) rotate(2deg); }
}

.library-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}

.network-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.network-selector label {
    font-weight: 600;
}

.network-selector select {
    padding: 0.5rem;
    border: none;
    border-radius: var(--border-radius);
    background: white;
    color: var(--text-primary);
    font-family: var(--font-body);
    transition: var(--transition-normal);
}

.network-selector select:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
}

/* Wallet Section */
.wallet-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
    min-width: 200px;
}

.wallet-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: var(--transition-normal);
}

.wallet-status.connected {
    background: rgba(34, 139, 34, 0.2);
    border: 2px solid rgba(34, 139, 34, 0.3);
    animation: pulseGreen 2s ease-in-out infinite;
}

.wallet-status.disconnected {
    background: rgba(178, 34, 34, 0.2);
    border: 2px solid rgba(178, 34, 34, 0.3);
    animation: pulseRed 2s ease-in-out infinite;
}

@keyframes pulseGreen {
    0%, 100% { box-shadow: 0 0 5px rgba(34, 139, 34, 0.3); }
    50% { box-shadow: 0 0 20px rgba(34, 139, 34, 0.6); }
}

@keyframes pulseRed {
    0%, 100% { box-shadow: 0 0 5px rgba(178, 34, 34, 0.3); }
    50% { box-shadow: 0 0 20px rgba(178, 34, 34, 0.6); }
}

.wallet-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: statusBlink 1.5s ease-in-out infinite;
}

@keyframes statusBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.wallet-info {
    text-align: right;
    font-size: 0.9rem;
    line-height: 1.4;
}

.wallet-info small {
    display: block;
    opacity: 0.8;
    font-weight: 600;
}

.wallet-address {
    margin-bottom: 0.25rem;
}

.connect-btn, .disconnect-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    background: white;
    color: var(--primary-color);
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.connect-btn:hover, .disconnect-btn:hover {
    background: var(--background-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* Navigation */
.library-nav {
    background: var(--background-secondary);
    padding: 0;
    display: flex;
    border-bottom: 3px solid var(--border-color);
    overflow-x: auto;
}

.nav-btn {
    flex: 1;
    min-width: 150px;
    padding: 1.25rem 2rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    border-bottom: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 69, 19, 0.1), transparent);
    transition: var(--transition-slow);
}

.nav-btn:hover::before {
    left: 100%;
}

.nav-btn:hover {
    background: rgba(139, 69, 19, 0.1);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: var(--background-paper);
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    box-shadow: 0 -2px 10px rgba(139, 69, 19, 0.2);
}

.nav-btn i {
    transition: var(--transition-normal);
}

.nav-btn:hover i {
    transform: scale(1.1);
}

/* Main Content */
.library-main {
    padding: 2rem;
}

.library-section {
    display: none;
    animation: fadeInUp 0.5s ease-out;
}

.library-section.active {
    display: block;
}

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

.section-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.05), rgba(210, 105, 30, 0.05));
    border-radius: var(--border-radius-large);
    border: 2px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.section-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(139, 69, 19, 0.03) 0%, transparent 70%);
    animation: backgroundRotate 20s linear infinite;
}

@keyframes backgroundRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.section-header h2 {
    font-family: var(--font-serif);
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    position: relative;
    z-index: 1;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Audio Library Grid */
.audio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    align-items: start;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    align-items: start;
}

@media (max-width: 968px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .audio-grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
    }
}

/* Card Styles */
.card {
    background: var(--background-paper);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-large);
    padding: 1.5rem;
    box-shadow: var(--shadow-medium);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    transform: translateX(-100%);
    transition: var(--transition-slow);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-heavy);
}

.card:hover::before {
    transform: translateX(0);
}

.card h3 {
    font-family: var(--font-serif);
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.3rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition-normal);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
    transform: translateY(-1px);
}

/* Arguments Section */
.arguments-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
}

.arguments-section h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.argument-group {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: var(--transition-normal);
}

.argument-group:hover {
    box-shadow: var(--shadow-light);
    transform: translateY(-1px);
}

.argument-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

.arg-type {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    font-family: var(--font-body);
}

.remove-arg-btn {
    padding: 0.5rem;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.remove-arg-btn:hover {
    background: #8B0000;
    transform: scale(1.05);
}

.argument-input {
    position: relative;
}

.arg-value, .arg-text-area {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition-normal);
}

.arg-text-area {
    resize: vertical;
    min-height: 120px;
    font-family: 'Courier New', monospace;
    line-height: 1.5;
}

.arg-value:focus, .arg-text-area:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.add-arg-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.add-arg-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

/* Submit Buttons */
.submit-btn {
    width: 100%;
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--border-radius);
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2rem;
}

.read-btn {
    background: var(--success-color);
    color: white;
}

.read-btn:hover:not(:disabled) {
    background: #1F7A1F;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

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

.write-btn:hover:not(:disabled) {
    background: #723A10;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.submit-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

/* Results Display */
.results-display, .transaction-status {
    height: fit-content;
    min-height: 300px;
}

.results-content {
    min-height: 200px;
    max-height: 600px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    text-align: center;
    color: var(--text-muted);
    animation: emptyStatePulse 3s ease-in-out infinite alternate;
}

@keyframes emptyStatePulse {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.empty-state p {
    font-size: 1.1rem;
    line-height: 1.5;
}

/* Writing Tools Specific Styles */

/* Chapter Editor Styles */
.chapter-editor-card {
    min-height: 600px;
}

.goal-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.goal-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.goal-controls input {
    flex: 1;
    min-width: 150px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    font-family: var(--font-body);
}

.goal-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    background: var(--primary-color);
    color: white;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.goal-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

.goal-btn.clear {
    background: var(--error-color);
}

.goal-btn.clear:hover {
    background: #8B0000;
}

.goal-display {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(139, 69, 19, 0.05);
    border-radius: var(--border-radius);
    border: 1px solid var(--primary-color);
}

.goal-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--primary-color));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: var(--progress-width, 0%);
}

.progress-text {
    font-weight: 600;
    color: var(--primary-color);
}

.editor-container {
    margin-bottom: 1.5rem;
}

.chapter-textarea {
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    transition: var(--transition-normal);
}

.chapter-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.stats-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.5rem;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.extended-stats {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.editor-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    background: var(--accent-color);
    color: white;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.action-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

.action-btn.clear {
    background: var(--error-color);
}

.action-btn.clear:hover {
    background: #8B0000;
}

/* Style Formatter Styles */
.formatter-card {
    min-height: 600px;
}

.format-toolbar {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.format-btn {
    padding: 0.5rem;
    border: none;
    border-radius: var(--border-radius);
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
}

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

.formatter-container {
    margin-bottom: 1.5rem;
}

.formatter-textarea {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    transition: var(--transition-normal);
}

.formatter-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.formatter-stats {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.stats-row .stat-item {
    flex: 1;
    min-width: 100px;
}

.cost-breakdown {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.cost-breakdown h5 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.cost-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

.cost-item {
    padding: 0.25rem 0.5rem;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.preview-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.preview-section h5 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.formatted-preview {
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    font-family: var(--font-body);
    line-height: 1.6;
}

.empty-preview {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    margin-top: 2rem;
}

.formatter-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Art Gallery Styles */
.encoder-card, .decoder-card {
    min-height: 500px;
}

.upload-section {
    margin-bottom: 1.5rem;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-normal);
    background: var(--background-secondary);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(139, 69, 19, 0.05);
}

.upload-area i {
    font-size: 3rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.upload-area p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.image-preview {
    text-align: center;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    margin-bottom: 1rem;
}

.image-info {
    text-align: left;
}

.image-info p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.encoding-options {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.encoding-options .form-group {
    margin-bottom: 1rem;
}

.encoding-options .form-group:last-child {
    margin-bottom: 0;
}

#quality-slider {
    width: 100%;
    margin-bottom: 0.5rem;
}

#quality-value {
    font-weight: 600;
    color: var(--primary-color);
}

.output-section {
    margin-bottom: 1.5rem;
}

.base64-textarea {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    resize: vertical;
    transition: var(--transition-normal);
}

.base64-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.output-stats {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.output-stats .stat-item {
    flex: 1;
    min-width: 120px;
}

.decoder-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.decoded-preview {
    text-align: center;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.decoded-preview h5 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.decoded-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--background-paper);
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-heavy);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    color: var(--primary-color);
    font-family: var(--font-serif);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-normal);
}

.modal-close:hover {
    color: var(--error-color);
    transform: scale(1.1);
}

.modal-body {
    padding: 1.5rem;
}

.wallet-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.wallet-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--background-secondary);
    cursor: pointer;
    transition: var(--transition-normal);
    text-align: left;
}

.wallet-option:hover {
    border-color: var(--primary-color);
    background: rgba(139, 69, 19, 0.05);
    transform: translateY(-2px);
}

.wallet-icon {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.wallet-info h4 {
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.wallet-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Loading Modal */
.loading-modal .modal-content {
    max-width: 300px;
    text-align: center;
}

.loading-content {
    padding: 2rem;
}

.loading-spinner {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.loading-content h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.loading-content p {
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .library-header {
        flex-direction: column;
        text-align: center;
    }
    
    .wallet-section {
        align-items: center;
    }
    
    .library-nav {
        flex-direction: column;
    }
    
    .nav-btn {
        min-width: auto;
        border-bottom: none;
        border-right: 3px solid transparent;
    }
    
    .nav-btn.active {
        border-bottom: none;
        border-right-color: var(--primary-color);
    }
    
    .library-main {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    
    .format-toolbar {
        justify-content: center;
    }
    
    .goal-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-btn, .goal-btn {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .library-title {
        font-size: 2rem;
    }
    
    .section-header h2 {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Success/Error/Warning States */
.success {
    color: var(--success-color);
    background: rgba(34, 139, 34, 0.1);
    border-color: var(--success-color);
}

.error {
    color: var(--error-color);
    background: rgba(178, 34, 34, 0.1);
    border-color: var(--error-color);
}

.warning {
    color: var(--warning-color);
    background: rgba(218, 165, 32, 0.1);
    border-color: var(--warning-color);
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.5);
        --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.5);
        --shadow-heavy: 0 8px 24px rgba(0, 0, 0, 0.5);
    }
}

/* Platform Description Section */
.platform-description {
    margin: 3rem 0;
    padding: 0 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.description-card {
    text-align: center;
    padding: 2.5rem;
    background: linear-gradient(135deg, var(--background-paper), var(--background-secondary));
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

.description-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(139, 69, 19, 0.03) 0%, transparent 70%);
    animation: backgroundRotate 30s linear infinite;
}

.description-content {
    position: relative;
    z-index: 1;
}

.description-content h2 {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.description-text {
    font-size: 1.2rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Reference Tables Section */
.reference-section {
    margin: 3rem 0;
    padding: 0 2rem;
    background: linear-gradient(135deg, var(--background-primary), var(--background-secondary));
}

.reference-tables-wrapper {
    display: grid;
    gap: 3rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 0;
}

.reference-table-card {
    background: var(--background-paper);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-large);
    padding: 2rem;
    box-shadow: var(--shadow-medium);
    transition: var(--transition-normal);
}

.reference-table-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-heavy);
}

.reference-table-card h2 {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.contract-address {
    background: var(--background-secondary);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary-color);
}

.contract-address code {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 600;
}

.table-container {
    overflow-x: auto;
    margin: 1.5rem 0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
}

.function-table, .syntax-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.function-table th, .syntax-table th {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem;
    text-align: left;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1rem;
}

.function-table td, .syntax-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
    font-family: var(--font-body);
}

.function-table tr:nth-child(even), .syntax-table tr:nth-child(even) {
    background: rgba(139, 69, 19, 0.03);
}

.function-table tr:hover, .syntax-table tr:hover {
    background: rgba(139, 69, 19, 0.08);
    transition: var(--transition-fast);
}

.function-table code, .syntax-table code {
    background: var(--background-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.function-table td:first-child code {
    background: rgba(139, 69, 19, 0.1);
    border: 1px solid var(--primary-color);
    font-weight: 700;
}

.syntax-note {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(218, 165, 32, 0.1);
    border: 1px solid var(--warning-color);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--warning-color);
}

.syntax-note p {
    margin: 0;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Table responsive behavior */
@media (max-width: 968px) {
    .platform-description, .reference-section {
        padding: 0 1rem;
    }
    
    .description-card {
        padding: 2rem;
    }
    
    .description-content h2 {
        font-size: 1.8rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .description-text {
        font-size: 1.1rem;
    }
    
    .reference-table-card {
        padding: 1.5rem;
    }
    
    .reference-table-card h2 {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .table-container {
        margin: 1rem -1.5rem;
    }
    
    .function-table th, .syntax-table th,
    .function-table td, .syntax-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .contract-address {
        margin: 1rem -1.5rem 2rem;
        border-radius: 0;
        padding: 1rem 1.5rem;
    }
    
    .contract-address code {
        font-size: 0.9rem;
        word-break: break-all;
    }
}

@media (max-width: 480px) {
    .description-content h2 {
        font-size: 1.6rem;
    }
    
    .description-text {
        font-size: 1rem;
    }
    
    .reference-table-card h2 {
        font-size: 1.3rem;
    }
    
    .function-table th, .syntax-table th,
    .function-table td, .syntax-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
}
