/* JWT Encoder & Decoder Styling */

/* Modern Mode Selector */
.mode-selector-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    padding: 0;
}

.mode-option {
    position: relative;
}

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

.mode-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    height: 100%;
}

.mode-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.mode-icon .fsvg {
    opacity: 0.6;
    transition: all 0.3s ease;
}

.mode-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mode-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
}

.mode-desc {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
}

/* Hover State */
.mode-label:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.mode-label:hover .mode-icon {
    background: #e8edf3;
}

.mode-label:hover .mode-icon .fsvg {
    opacity: 0.8;
}

/* Checked State */
.mode-input:checked + .mode-label {
    border-color: #052c65;
    background: #f8fafc;
    box-shadow: 0 2px 8px rgba(5, 44, 101, 0.1), inset 0 0 0 1px rgba(5, 44, 101, 0.1);
    transform: translateY(0);
}

.mode-input:checked + .mode-label .mode-icon {
    background: #052c65;
}

.mode-input:checked + .mode-label .mode-icon .fsvg {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.mode-input:checked + .mode-label .mode-title {
    color: #052c65;
}

.mode-input:checked + .mode-label .mode-desc {
    color: #475569;
}

/* Dark Mode for Mode Selector */
[data-bs-theme="dark"] .mode-label {
    background: #1a1d23;
    border-color: #343a40;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .mode-icon {
    background: #2d3239;
}

[data-bs-theme="dark"] .mode-title {
    color: #e9ecef;
}

[data-bs-theme="dark"] .mode-desc {
    color: #9ca3af;
}

[data-bs-theme="dark"] .mode-label:hover {
    border-color: #495057;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .mode-label:hover .mode-icon {
    background: #3a3f47;
}

[data-bs-theme="dark"] .mode-input:checked + .mode-label {
    border-color: #6ea8fe;
    background: #212529;
    box-shadow: 0 2px 8px rgba(110, 168, 254, 0.2), inset 0 0 0 1px rgba(110, 168, 254, 0.2);
}

[data-bs-theme="dark"] .mode-input:checked + .mode-label .mode-icon {
    background: #6ea8fe;
}

[data-bs-theme="dark"] .mode-input:checked + .mode-label .mode-title {
    color: #6ea8fe;
}

[data-bs-theme="dark"] .mode-input:checked + .mode-label .mode-desc {
    color: #9ca3af;
}

/* Textarea Styling */
.jwt-textarea,
.jwt-output {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    tab-size: 2;
    resize: vertical;
}

.jwt-textarea {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
}

.jwt-textarea:focus {
    background: #ffffff;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.jwt-output {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

/* Section Labels */
.jwt-section-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
    color: #052c65;
    margin-bottom: 8px;
}

.jwt-section-label .fsvg {
    opacity: 0.7;
}

/* Token Info Container */
.jwt-info-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.jwt-info-item {
    display: flex;
    flex-direction: column;
    min-width: 180px;
}

.jwt-info-label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.jwt-info-value {
    font-size: 16px;
    font-weight: 600;
    color: #212529;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* Status indicators */
.jwt-status-expired {
    color: #dc3545;
    font-weight: 700;
}

.jwt-status-valid {
    color: #198754;
    font-weight: 700;
}

/* Claims Container */
.jwt-claims-container {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
}

.jwt-claims-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.jwt-claim-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s ease;
}

.jwt-claim-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.jwt-claim-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.jwt-claim-label {
    font-size: 13px;
    font-weight: 600;
    color: #052c65;
}

.jwt-claim-key {
    font-size: 11px;
    padding: 2px 6px;
    background: #e9ecef;
    border-radius: 4px;
    color: #495057;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.jwt-claim-value {
    font-size: 14px;
    color: #212529;
    word-break: break-word;
    line-height: 1.5;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* Dark Mode */
[data-bs-theme="dark"] .jwt-textarea,
[data-bs-theme="dark"] .jwt-output {
    background: #1a1d23;
    border-color: #343a40;
    color: #e9ecef;
}

[data-bs-theme="dark"] .jwt-textarea {
    border-color: #495057;
}

[data-bs-theme="dark"] .jwt-textarea:focus {
    background: #212529;
    border-color: #86b7fe;
}

[data-bs-theme="dark"] .jwt-section-label {
    color: #6ea8fe;
}

[data-bs-theme="dark"] .jwt-info-container {
    background: #1a1d23;
    border-color: #343a40;
}

[data-bs-theme="dark"] .jwt-info-label {
    color: #9ca3af;
}

[data-bs-theme="dark"] .jwt-info-value {
    color: #e9ecef;
}

[data-bs-theme="dark"] .jwt-claims-container {
    background: #1a1d23;
    border-color: #343a40;
}

[data-bs-theme="dark"] .jwt-claim-item {
    background: #212529;
    border-color: #495057;
}

[data-bs-theme="dark"] .jwt-claim-item:hover {
    border-color: #6c757d;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .jwt-claim-label {
    color: #6ea8fe;
}

[data-bs-theme="dark"] .jwt-claim-key {
    background: #343a40;
    color: #9ca3af;
}

[data-bs-theme="dark"] .jwt-claim-value {
    color: #e9ecef;
}

/* Button Styling */
.toolBtn {
    transition: all 0.2s ease;
    border-radius: 6px;
    font-weight: 500;
    padding: 8px 16px;
}

.toolBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.toolBtn:active {
    transform: translateY(0);
}

/* Swap Button - Custom Style */
.btn-swap {
    background-color: transparent;
    border: 1px solid #052c65;
    color: #052c65;
}

.btn-swap .fsvg {
    filter: none;
}

.btn-swap:hover {
    background-color: #052c65;
    border-color: #052c65;
    color: #ffffff;
}

.btn-swap:hover .fsvg {
    filter: brightness(0) invert(1);
}

.btn-swap:focus,
.btn-swap:active {
    background-color: #041f4d;
    border-color: #041f4d;
    color: #ffffff;
    box-shadow: 0 0 0 0.25rem rgba(5, 44, 101, 0.25);
}

.btn-swap:focus .fsvg,
.btn-swap:active .fsvg {
    filter: brightness(0) invert(1);
}

[data-bs-theme="dark"] .btn-swap {
    border-color: #6ea8fe;
    color: #6ea8fe;
}

[data-bs-theme="dark"] .btn-swap:hover {
    background-color: #6ea8fe;
    border-color: #6ea8fe;
    color: #000000;
}

[data-bs-theme="dark"] .btn-swap:hover .fsvg {
    filter: none;
}

[data-bs-theme="dark"] .btn-swap:focus,
[data-bs-theme="dark"] .btn-swap:active {
    background-color: #548cd4;
    border-color: #548cd4;
    color: #000000;
}

/* Status Message */
#statusMessage {
    animation: slideDown 0.3s ease-out;
}

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

#statusContent {
    margin-bottom: 0;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
}

/* Alert Colors */
.alert-success {
    background-color: #d1e7dd;
    border-color: #badbcc;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c2c7;
    color: #842029;
}

.alert-info {
    background-color: #cff4fc;
    border-color: #b6effb;
    color: #055160;
}

[data-bs-theme="dark"] .alert-success {
    background-color: #0f5132;
    border-color: #146c43;
    color: #d1e7dd;
}

[data-bs-theme="dark"] .alert-danger {
    background-color: #842029;
    border-color: #a52834;
    color: #f8d7da;
}

[data-bs-theme="dark"] .alert-info {
    background-color: #055160;
    border-color: #087990;
    color: #cff4fc;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mode-selector-modern {
        grid-template-columns: 1fr;
    }

    .mode-label {
        padding: 14px;
    }

    .mode-icon {
        width: 44px;
        height: 44px;
    }

    .mode-title {
        font-size: 15px;
    }

    .mode-desc {
        font-size: 12px;
    }

    .jwt-claims-grid {
        grid-template-columns: 1fr;
    }

    .jwt-info-container {
        gap: 12px;
        padding: 12px;
    }

    .jwt-info-item {
        min-width: 140px;
    }

    .jwt-info-label {
        font-size: 11px;
    }

    .jwt-info-value {
        font-size: 14px;
    }

    .toolBtn {
        width: 100%;
        margin-bottom: 5px;
    }

    .jwt-textarea,
    .jwt-output {
        font-size: 13px;
    }
}

@media (max-width: 576px) {
    .mode-selector-modern {
        gap: 12px;
    }

    .mode-label {
        padding: 12px;
        gap: 10px;
    }

    .mode-icon {
        width: 40px;
        height: 40px;
    }

    .mode-icon img {
        width: 20px;
        height: 20px;
    }

    .jwt-claim-item {
        padding: 10px;
    }

    .jwt-claim-label {
        font-size: 12px;
    }

    .jwt-claim-key {
        font-size: 10px;
    }

    .jwt-claim-value {
        font-size: 13px;
    }
}

/* Loading Animation */
.toolBtn.loading {
    position: relative;
    pointer-events: none;
}

.toolBtn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

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

/* Placeholder Styling */
.jwt-textarea::placeholder {
    color: #6c757d;
    opacity: 0.7;
}

[data-bs-theme="dark"] .jwt-textarea::placeholder {
    color: #9ca3af;
    opacity: 0.8;
}

/* Output Container Animation */
#outputContainer {
    animation: fadeIn 0.4s ease-out;
}

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