* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0066cc;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --dark-color: #1a1a1a;
    --light-color: #f8f9fa;
    --border-color: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

main {
    padding: 30px;
}

footer {
    background: var(--light-color);
    border-top: 1px solid var(--border-color);
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
}

/* Status Section */
.status-section {
    margin-bottom: 30px;
}

.status-message {
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: 500;
    background-color: #e7f3ff;
    color: #0066cc;
    border-left: 4px solid #0066cc;
    animation: fadeIn 0.3s ease-in;
}

.status-message.success {
    background-color: #e8f5e9;
    color: #28a745;
    border-left-color: #28a745;
}

.status-message.error {
    background-color: #ffebee;
    color: #dc3545;
    border-left-color: #dc3545;
}

.status-message.warning {
    background-color: #fff3e0;
    color: #ff9800;
    border-left-color: #ff9800;
}

.status-message.waiting {
    background-color: #f3e5f5;
    color: #9c27b0;
    border-left-color: #9c27b0;
    animation: pulse 1s infinite;
}

.support-status {
    margin-top: 10px;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 0.95em;
    background-color: #f0f0f0;
}

.support-status.success {
    background-color: #e8f5e9;
    color: #28a745;
}

.support-status.warning {
    background-color: #fff3e0;
    color: #ff9800;
}

/* Button Section */
.button-section {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 150px;
    justify-content: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #0052a3;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
    width: 100%;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* Sections */
.section {
    margin-bottom: 30px;
    padding: 25px;
    background-color: var(--light-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.section h2 {
    margin-bottom: 20px;
    color: var(--dark-color);
    font-size: 1.5em;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

/* Form Groups */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    font-family: 'Courier New', monospace;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="number"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-group input[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    font-size: 0.95em;
}

/* Write Options */
.write-options {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option input[type="radio"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.option label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
}

/* History Section */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

.history-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    transition: all 0.3s ease;
}

.history-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.history-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.history-uid {
    font-weight: 600;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.history-type {
    background-color: #e3f2fd;
    color: #0066cc;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
}

.history-time {
    color: #999;
    font-size: 0.85em;
}

.history-content {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 8px;
    padding: 8px;
    background-color: #fafafa;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    word-break: break-word;
}

.history-delete {
    background-color: var(--danger-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.history-delete:hover {
    background-color: #c82333;
}

/* Advanced Section */
.advanced-section details {
    cursor: pointer;
}

.advanced-section summary {
    font-weight: 600;
    color: var(--primary-color);
    padding: 10px;
    background-color: white;
    border-radius: 6px;
    user-select: none;
    transition: all 0.3s ease;
}

.advanced-section summary:hover {
    background-color: #f0f0f0;
}

.advanced-content {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        border-radius: 0;
    }

    header {
        padding: 30px 15px;
    }

    header h1 {
        font-size: 1.8em;
    }

    main {
        padding: 20px;
    }

    .button-section {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        min-width: auto;
    }

    .history-header {
        flex-direction: column;
    }

    .write-options {
        flex-direction: column;
        gap: 10px;
    }

    .option {
        width: 100%;
    }

    .section {
        padding: 15px;
    }

    .section h2 {
        font-size: 1.2em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
    }

    header h1 {
        font-size: 1.5em;
    }

    header p {
        font-size: 1em;
    }

    .section {
        padding: 12px;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 10px;
        font-size: 16px;
    }
}
