/* JWT Encoder & Decoder Tool Styles */

.jwt-tool {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Mode Selector */
.mode-selector {
    margin-bottom: 30px;
}

.mode-tabs {
    display: flex;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.mode-tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    color: #666;
}

.mode-tab.active {
    background: #007bff;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.mode-tab:hover:not(.active) {
    background: #e9ecef;
    color: #333;
}

/* Common Styles */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-clear {
    background-color: #dc3545;
    color: white;
}

.btn-clear:hover {
    background-color: #c82333;
}

.btn-copy {
    background-color: #28a745;
    color: white;
    font-size: 12px;
    padding: 6px 12px;
}

.btn-copy:hover {
    background-color: #1e7e34;
}

/* Input Sections */
.input-section,
.input-group {
    margin-bottom: 25px;
}

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

.input-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
}

.input-controls {
    display: flex;
    gap: 8px;
}

#jwtInput,
#headerInput,
#payloadInput {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s ease;
}

#jwtInput:focus,
#headerInput:focus,
#payloadInput:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

#secretInput {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

#secretInput:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.secret-note {
    margin-top: 8px;
    color: #856404;
    background: #fff3cd;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ffeaa7;
}

/* JWT Status */
.jwt-status {
    margin-top: 10px;
    padding: 10px 15px;
    border-radius: 6px;
    font-weight: 500;
    display: none;
}

.jwt-status.valid {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.jwt-status.invalid {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* JWT Parts */
.jwt-parts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.jwt-part {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

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

.part-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
}

.part-content {
    background: white;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #e9ecef;
}

.json-output,
.signature-output {
    margin: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    white-space: pre-wrap;
    word-break: break-all;
}

.signature-output {
    color: #6c757d;
    font-style: italic;
}

/* Token Info */
.token-info {
    background: #e8f4fd;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #b8daff;
    margin-bottom: 20px;
}

.token-info h4 {
    margin: 0 0 15px 0;
    color: #004085;
    font-size: 1.1rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #cce7ff;
}

.info-label {
    font-weight: 500;
    color: #004085;
}

.info-value {
    color: #333;
    font-weight: 600;
    text-align: right;
}

.info-value.expired {
    color: #dc3545;
}

.info-value.valid {
    color: #28a745;
}

/* Encode Mode */
.encode-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.encode-inputs .input-group:last-child {
    grid-column: 1 / -1;
}

.encode-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

/* Encode Output */
.encode-output {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #e9ecef;
}

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

.output-header h3 {
    margin: 0;
    color: #333;
}

.output-controls {
    display: flex;
    gap: 10px;
}

.jwt-output-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.jwt-token {
    margin: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    word-break: break-all;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

/* JWT Parts Visual */
.jwt-parts-visual {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    overflow-x: auto;
}

.visual-part {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 120px;
}

.part-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.part-value {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 10px;
    padding: 6px 8px;
    border-radius: 4px;
    word-break: break-all;
    text-align: center;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-part .part-label {
    color: #dc3545;
}

.header-part .part-value {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.payload-part .part-label {
    color: #6f42c1;
}

.payload-part .part-value {
    background: #e2e3f3;
    color: #4c2a85;
    border: 1px solid #c8c9f0;
}

.signature-part .part-label {
    color: #007bff;
}

.signature-part .part-value {
    background: #cce7ff;
    color: #004085;
    border: 1px solid #99d6ff;
}

.visual-separator {
    font-weight: bold;
    color: #6c757d;
    font-size: 18px;
}

/* Info Panel */
.info-panel {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #e9ecef;
    margin-top: 30px;
}

.info-panel h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.2rem;
}

.info-content p {
    margin: 0 0 15px 0;
    color: #555;
    line-height: 1.6;
}

.info-content ul {
    margin: 0 0 15px 0;
    padding-left: 20px;
    color: #555;
}

.info-content li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.info-content strong {
    color: #333;
}

/* Responsive Design */
@media (max-width: 768px) {
    .jwt-tool {
        padding: 15px;
    }
    
    .mode-tabs {
        flex-direction: column;
    }
    
    .input-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .input-controls {
        width: 100%;
        justify-content: flex-end;
    }
    
    .encode-inputs {
        grid-template-columns: 1fr;
    }
    
    .encode-inputs .input-group:last-child {
        grid-column: 1;
    }
    
    .encode-actions {
        flex-direction: column;
    }
    
    .output-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .output-controls {
        width: 100%;
        justify-content: center;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .jwt-parts-visual {
        flex-direction: column;
        gap: 15px;
    }
    
    .visual-separator {
        transform: rotate(90deg);
    }
    
    .visual-part {
        min-width: auto;
        width: 100%;
    }
    
    .part-value {
        max-width: 100%;
        white-space: pre-wrap;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .jwt-token {
        font-size: 11px;
    }
    
    .json-output,
    .signature-output {
        font-size: 12px;
    }
    
    .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .info-value {
        text-align: left;
    }
}