/* --- General Resets & Typography --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #007BFF;
    --primary-color-dark: #0056b3;
    --background-color: #f4f7f9;
    --border-color: #dee2e6;
    --card-bg: #ffffff;
    --text-dark: #212529;
    --text-light: #6c757d;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --shadow: 0 2px 10px rgba(0,0,0,0.05);
    --border-radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--background-color);
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1rem;
}

h1 {
    color: var(--text-dark);
    font-size: 1.75rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 2rem;
}

/* --- Card & Form Layout --- */
.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

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

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-light);
}

select, input[type="text"], input[type="number"], textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #fff;
    font-size: 1rem;
    font-family: var(--font-sans);
    transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus, input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

textarea {
    min-height: 80px;
    resize: vertical;
}

.img-preview {
    text-align: center;
    margin: 2rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    border: 1px dashed var(--border-color);
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 6px;
}

#params {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* --- Buttons --- */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

button, .button {
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    font-family: var(--font-sans);
    text-align: center;
    transition: all 0.2s ease-in-out;
    display: inline-block;
    text-decoration: none;
}

#add-spec-btn {
    background: var(--primary-color);
    color: #fff;
}
#add-spec-btn:hover {
    background: var(--primary-color-dark);
}

#new-spec-btn, #share-spec-btn {
    background: #6c757d;
    color: #fff;
}
#new-spec-btn:hover, #share-spec-btn:hover {
    background: #5a6268;
}

/* --- Results & Table --- */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.spec-label {
    font-size: 1.25rem;
    font-weight: 600;
}

.result-header .button-group {
    display: flex;
    gap: 0.5rem;
}

.result-header .copy-btn,
.result-header .excel-btn {
    background: #e9ecef;
    color: var(--text-dark);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
}

.result-header .copy-btn:hover,
.result-header .excel-btn:hover {
    background: #dee2e6;
}

.spec-table-wrapper {
    overflow-x: auto;
}

.spec-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.95rem;
    min-width: 1000px;
}

.spec-table th, .spec-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.spec-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    white-space: nowrap;
}

.spec-table tr:last-child td {
    border-bottom: none;
}

.spec-table tbody tr:hover {
    background-color: #f1f3f5;
}

.spec-table .delete-btn {
    background: transparent;
    color: var(--text-light);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 20px;
    line-height: 28px;
    text-align: center;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}
.spec-table .delete-btn:hover {
    background: #dc3545;
    color: #fff;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .container {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }
    .card {
        padding: 1.5rem;
    }
    h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .form-grid, #params {
        grid-template-columns: 1fr;
    }
    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }
}