/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --primary-hover: #45a049;
    --secondary-color: #007bff;
    --secondary-hover: #0056b3;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --dark-color: #333;
    --light-color: #f8f9fa;
    --border-color: #e1e5e9;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 15px;
}

.header-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    display: inline-block;
}

.header-info small {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Form Styles */
.form-section {
    padding: 40px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1rem;
}

.required-indicator {
    color: var(--error-color);
    font-size: 0.875rem;
    font-weight: 500;
}

.optional-indicator {
    color: #666;
    font-size: 0.875rem;
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: var(--transition);
}

.toggle-password:hover {
    background: var(--light-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    font-family: 'Courier New', monospace;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: #666;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* DateTime and Preset Buttons */
.datetime-input {
    position: relative;
}

.preset-buttons {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.preset-btn {
    background: var(--light-color);
    border: 1px solid var(--border-color);
    color: var(--dark-color);
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition);
    font-weight: 500;
}

.preset-btn:hover {
    background: #dee2e6;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

/* Generate Button */
.generate-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    padding: 18px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.3);
}

.generate-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Result Section */
.result-section {
    display: none;
    background: var(--light-color);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.result-section.show {
    display: block;
    animation: fadeInUp 0.5s ease;
}

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

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

.result-header h3 {
    color: var(--dark-color);
    font-size: 1.3rem;
    margin: 0;
}

.result-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.copy-btn,
.verify-btn,
.verify-token-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

.copy-btn:hover,
.verify-btn:hover,
.verify-token-btn:hover {
    background: var(--secondary-hover);
    transform: translateY(-1px);
}

.verify-btn {
    background: #6c757d;
}

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

/* Token Output */
.token-output {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    word-break: break-all;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
    position: relative;
}

.token-output:before {
    content: 'JWT Token:';
    position: absolute;
    top: -10px;
    left: 15px;
    background: white;
    padding: 0 8px;
    font-size: 0.75rem;
    color: #666;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 600;
}

/* Token Info */
.token-info {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f4;
    gap: 15px;
}

.info-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.info-label {
    font-weight: 600;
    color: var(--dark-color);
    min-width: 120px;
    flex-shrink: 0;
}

.info-value {
    color: #666;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    word-break: break-word;
    text-align: right;
}

/* Verification Section */
.verification-section {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.verification-header h4 {
    color: var(--dark-color);
    margin-bottom: 15px;
}

.verification-content .form-group {
    margin-bottom: 15px;
}

#verificationResult {
    margin-top: 15px;
    padding: 15px;
    border-radius: var(--border-radius);
    font-weight: 500;
}

/* Messages */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-top: 15px;
    border: 1px solid #f5c6cb;
    border-left: 4px solid var(--error-color);
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-top: 15px;
    border: 1px solid #c3e6cb;
    border-left: 4px solid var(--success-color);
}

.warning-message {
    background: #fff3cd;
    color: #856404;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-top: 15px;
    border: 1px solid #ffeaa7;
    border-left: 4px solid var(--warning-color);
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tool Information */
.tool-info {
    background: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 25px;
    margin-top: 30px;
    border: 1px solid var(--border-color);
}

.tool-info h3 {
    color: var(--dark-color);
    margin-bottom: 20px;
    font-size: 1.2rem;
}

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

.info-item {
    background: white;
    padding: 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.info-item strong {
    color: var(--dark-color);
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.info-item p {
    color: #666;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Footer */
.footer {
    background: var(--dark-color);
    color: white;
    padding: 20px 30px;
    text-align: center;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* Field Error Styles */
.field-error {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 5px;
    padding: 8px 12px;
    background: #f8d7da;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 30px 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .form-section {
        padding: 25px 20px;
    }
    
    .preset-buttons {
        flex-direction: column;
    }
    
    .preset-btn {
        text-align: center;
        width: 100%;
    }
    
    .result-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .result-actions {
        justify-content: center;
    }
    
    .info-row {
        flex-direction: column;
        gap: 5px;
    }
    
    .info-value {
        text-align: left;
    }
    
    .footer-content {
        flex-direction: column;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.75rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .form-section {
        padding: 20px 15px;
    }
    
    .generate-btn {
        font-size: 1rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .header {
        background: #f8f9fa !important;
        color: black !important;
    }
    
    .generate-btn,
    .copy-btn,
    .verify-btn {
        display: none;
    }
}