* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f0eb;
    color: #333;
}

.screen { display: none; }
.screen.active { display: block; }

/* Login */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.login-container h1 {
    margin-bottom: 30px;
    color: #722f37;
    font-size: 2em;
}

.login-container input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.toggle-link {
    margin-top: 16px;
    color: #666;
}

.toggle-link a {
    color: #722f37;
    cursor: pointer;
}

.error {
    color: #d32f2f;
    margin-top: 10px;
    font-size: 14px;
}

.success {
    color: #388e3c;
    margin-top: 10px;
    font-size: 14px;
}

/* Header */
header {
    background: linear-gradient(135deg, #722f37, #4a1a1f);
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 { font-size: 1.4em; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

#user-display {
    font-size: 14px;
    opacity: 0.9;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    background: #e0d5cc;
    color: #333;
    transition: all 0.2s;
}

.btn:hover { opacity: 0.85; }

.btn-primary {
    background: #722f37;
    color: white;
}

.btn-small {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-danger {
    background: #d32f2f;
    color: white;
}

.btn-success {
    background: #388e3c;
    color: white;
}

/* Toolbar */
.toolbar {
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    background: white;
    border-bottom: 1px solid #e0d5cc;
}

.search-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.search-bar input, .search-bar select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.search-bar input { width: 250px; }

/* Alert */
.alert {
    margin: 12px 24px;
    padding: 12px 16px;
    background: #fff3e0;
    border: 1px solid #ffb74d;
    border-radius: 8px;
    color: #e65100;
    font-size: 14px;
}

/* Table */
.table-container {
    padding: 0 24px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

th {
    background: #f8f4f0;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: #555;
    font-size: 13px;
    border-bottom: 2px solid #e0d5cc;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    background: #f0e8e0;
}

td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0ebe6;
    font-size: 14px;
    vertical-align: middle;
}

tr:hover td {
    background: #faf7f4;
}

td img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
}

.wine-count {
    padding: 12px 24px;
    color: #888;
    font-size: 13px;
}

.stock-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stock-controls button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background: white;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stock-controls button:hover {
    background: #f0f0f0;
}

.type-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.type-red { background: #fce4ec; color: #c62828; }
.type-white { background: #fff9c4; color: #f9a825; }
.type-rosé { background: #fce4ec; color: #e91e63; }

.favorite-star {
    cursor: pointer;
    font-size: 18px;
    color: #ccc;
}

.favorite-star.active {
    color: #ffc107;
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close:hover { color: #333; }

.modal-content h2 {
    margin-bottom: 20px;
    color: #722f37;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-group {
    flex: 1;
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 13px;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.form-group input[type="checkbox"] {
    width: auto;
}

.form-group textarea {
    resize: vertical;
}

#current-image img {
    max-width: 120px;
    margin-top: 8px;
    border-radius: 6px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row { flex-direction: column; gap: 0; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-bar { flex-direction: column; }
    .search-bar input { width: 100%; }
}
