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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --error-color: #ef4444;
    --success-color: #22c55e;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Generator Section */
.generator-section {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-bottom: 2rem;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-color);
}

.tab-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.tab-btn.active {
    color: var(--primary-color);
    background: var(--surface-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

.tab-content {
    display: none;
    padding: 1.5rem;
}

.tab-content.active {
    display: block;
}

/* Generator Grid */
.generator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .generator-grid {
        grid-template-columns: 1fr;
    }
}

/* Input Panel */
.input-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
    font-family: monospace;
}

.hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Size Controls */
.size-controls {
    display: flex;
    gap: 1.5rem;
}

.size-input {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.size-input label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.size-input input[type="range"] {
    width: 100%;
    accent-color: var(--primary-color);
}

.size-input span,
.form-group > span:not(.hint) {
    font-size: 0.875rem;
    color: var(--primary-color);
    font-weight: 500;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--background-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

.btn-icon {
    font-size: 1.1rem;
}

/* Preview Panel */
.preview-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.preview-panel h3 {
    font-size: 1rem;
    color: var(--text-secondary);
}

.barcode-preview {
    background: white;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.barcode-preview svg {
    max-width: 100%;
    height: auto;
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
    display: none;
}

.error-message.visible {
    display: block;
}

.download-buttons {
    display: flex;
    gap: 0.75rem;
}

.download-buttons .btn {
    flex: 1;
}

/* Batch Generation */
.batch-container {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .batch-container {
        grid-template-columns: 1fr;
    }
}

.batch-input-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.batch-size-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.batch-preview-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.batch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.batch-header h3 {
    font-size: 1rem;
    color: var(--text-secondary);
}

.batch-results {
    background: var(--background-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
}

.empty-state {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

.batch-item {
    background: white;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.batch-item:last-child {
    margin-bottom: 0;
}

.batch-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.batch-item-value {
    font-family: monospace;
    font-weight: 500;
    color: var(--text-primary);
}

.batch-item-actions {
    display: flex;
    gap: 0.5rem;
}

.batch-item-actions .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.batch-item-preview {
    display: flex;
    justify-content: center;
    background: white;
    padding: 0.5rem;
}

.batch-item-preview svg {
    max-width: 100%;
    height: auto;
}

.batch-item-error {
    color: var(--error-color);
    font-size: 0.875rem;
    text-align: center;
    padding: 1rem;
}

/* Info Section */
.info-section {
    margin-top: 2rem;
}

.info-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.format-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.format-card {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.format-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.format-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.format-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.format-tag {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--background-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 1.5rem 1rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.footer a {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: white;
    text-decoration: underline;
}

/* Responsive Adjustments */
@media (max-width: 640px) {
    .header {
        padding: 1.5rem 1rem;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.9rem;
    }

    .main-content {
        padding: 1rem;
    }

    .tab-content {
        padding: 1rem;
    }

    .size-controls {
        flex-direction: column;
        gap: 1rem;
    }

    .download-buttons {
        flex-direction: column;
    }

    .batch-size-controls {
        grid-template-columns: 1fr;
    }

    .batch-header {
        flex-direction: column;
        align-items: stretch;
    }

    .batch-header .btn {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .tabs,
    .input-panel,
    .download-buttons,
    .info-section {
        display: none;
    }

    .barcode-preview {
        border: none;
        padding: 0;
    }
}

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

.batch-item {
    animation: fadeIn 0.3s ease;
}

/* Scrollbar Styling */
.batch-results::-webkit-scrollbar {
    width: 8px;
}

.batch-results::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: 4px;
}

.batch-results::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

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