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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border: #475569;
    --code-bg: #1e1e1e;
    
    --header-color: #ec4899;
    --payload-color: #8b5cf6;
    --signature-color: #06b6d4;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* Navigation */
.main-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: var(--surface);
    padding: 10px;
    border-radius: 12px;
    overflow-x: auto;
    flex-wrap: wrap;
}

.nav-btn {
    flex: 1;
    min-width: 140px;
    padding: 12px 20px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.nav-btn:hover {
    background: var(--surface-light);
    color: var(--text-primary);
}

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

.nav-icon {
    font-size: 1.2rem;
}

/* Tool Sections */
.tool-section {
    display: none;
}

.tool-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.tool-container {
    background: var(--surface);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.tool-header h2 {
    color: var(--text-primary);
    font-size: 1.8rem;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 5px;
    background: var(--surface-light);
    padding: 4px;
    border-radius: 8px;
}

.toggle-btn {
    padding: 8px 20px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    color: var(--text-primary);
}

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

/* IO Panels */
.io-panels {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.input-panel,
.output-panel {
    background: var(--surface-light);
    border-radius: 8px;
    padding: 20px;
}

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

.panel-header h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
}

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

.io-textarea {
    width: 100%;
    padding: 15px;
    background: var(--code-bg);
    color: var(--text-primary);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 200px;
}

.io-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.io-textarea::placeholder {
    color: #6a6a6a;
}

/* Conversion Actions */
.conversion-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-convert {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-convert:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

.convert-arrow {
    display: block;
}

/* Buttons */
.btn-primary {
    padding: 12px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

.btn-sm {
    padding: 6px 12px;
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-sm:hover {
    background: var(--border);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    transition: transform 0.2s ease;
}

.btn-icon:hover {
    transform: scale(1.2);
}

/* Info Boxes */
.info-box {
    padding: 15px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--info-color);
    border-radius: 8px;
    color: var(--info-color);
    font-size: 0.9rem;
    line-height: 1.6;
}

.security-warning {
    padding: 15px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning-color);
    border-radius: 8px;
    color: var(--warning-color);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* JWT Specific */
.jwt-input-section,
.hash-input-section,
.string-input-section {
    margin-bottom: 25px;
}

.jwt-textarea {
    width: 100%;
    padding: 15px;
    background: var(--code-bg);
    color: var(--text-primary);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 15px;
}

.jwt-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.jwt-result {
    margin-top: 25px;
}

.jwt-parts {
    display: grid;
    gap: 20px;
}

.jwt-part {
    background: var(--surface-light);
    border-radius: 8px;
    padding: 20px;
}

.part-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid currentColor;
}

.part-header.header-color {
    color: var(--header-color);
}

.part-header.payload-color {
    color: var(--payload-color);
}

.part-header.signature-color {
    color: var(--signature-color);
}

.part-header h3 {
    font-size: 1.2rem;
}

.jwt-content {
    background: var(--code-bg);
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.signature-text {
    word-break: break-all;
}

.signature-note {
    margin-top: 10px;
    padding: 10px;
    background: rgba(6, 182, 212, 0.1);
    border-radius: 6px;
    color: var(--signature-color);
    font-size: 0.85rem;
}

.claims-section {
    margin-top: 15px;
}

.claim-item {
    display: grid;
    grid-template-columns: 150px 1fr auto;
    gap: 15px;
    padding: 10px;
    background: var(--code-bg);
    border-radius: 6px;
    margin-bottom: 8px;
    align-items: center;
}

.claim-key {
    font-weight: 600;
    color: var(--payload-color);
    font-family: 'Consolas', monospace;
}

.claim-value {
    color: var(--text-primary);
    font-family: 'Consolas', monospace;
    word-break: break-all;
}

.claim-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

.jwt-info,
.hash-info-section {
    margin-top: 25px;
    padding: 20px;
    background: var(--surface-light);
    border-radius: 8px;
}

.jwt-structure {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    font-family: 'Consolas', monospace;
    font-size: 1.1rem;
}

.struct-part {
    padding: 8px 15px;
    border-radius: 6px;
    font-weight: 600;
}

.struct-part.header-color {
    background: var(--header-color);
    color: white;
}

.struct-part.payload-color {
    background: var(--payload-color);
    color: white;
}

.struct-part.signature-color {
    background: var(--signature-color);
    color: white;
}

/* Hash Results */
.hash-results {
    display: grid;
    gap: 15px;
    margin-bottom: 25px;
}

.hash-result {
    background: var(--surface-light);
    border-radius: 8px;
    padding: 20px;
}

.hash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.hash-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hash-info h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
}

.hash-warning {
    padding: 4px 10px;
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.hash-secure {
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.hash-output {
    background: var(--code-bg);
    padding: 12px 15px;
    border-radius: 6px;
    font-family: 'Consolas', monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-all;
}

/* Tables */
.info-table,
.encoding-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.info-table th,
.info-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.info-table th {
    background: var(--surface);
    color: var(--text-primary);
    font-weight: 600;
}

.info-table td {
    color: var(--text-secondary);
}

.status-secure {
    color: var(--success-color);
    font-weight: 600;
}

.status-deprecated {
    color: var(--warning-color);
    font-weight: 600;
}

.status-insecure {
    color: var(--error-color);
    font-weight: 600;
}

.encoding-table {
    background: var(--surface-light);
    border-radius: 8px;
    padding: 15px;
}

.encoding-table td {
    padding: 8px;
    color: var(--text-primary);
}

.encoding-examples {
    margin-top: 20px;
}

.encoding-examples h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

/* UUID */
.uuid-controls {
    display: grid;
    gap: 20px;
    margin-bottom: 25px;
}

.uuid-options {
    display: flex;
    gap: 20px;
}

.uuid-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-primary);
}

.uuid-quantity label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.uuid-quantity input {
    padding: 8px 12px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    width: 100px;
}

.uuid-output-section {
    background: var(--surface-light);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.uuid-list {
    display: grid;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.uuid-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--code-bg);
    border-radius: 6px;
}

.uuid-value {
    font-family: 'Consolas', monospace;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.uuid-copy {
    padding: 4px 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.uuid-copy:hover {
    background: var(--primary-hover);
}

/* String Utils */
.string-stats {
    background: var(--surface-light);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.string-stats h4 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

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

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: var(--code-bg);
    border-radius: 6px;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    color: var(--primary-color);
    font-weight: 600;
    font-family: 'Consolas', monospace;
}

.string-transforms {
    background: var(--surface-light);
    border-radius: 8px;
    padding: 20px;
}

.string-transforms h4 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.transform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.transform-btn {
    padding: 10px 15px;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.footer-note {
    margin-top: 10px;
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .io-panels {
        grid-template-columns: 1fr;
    }

    .conversion-actions {
        flex-direction: row;
        order: -1;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .tool-container {
        padding: 20px;
    }

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

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}