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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #667eea;
}

header h1 {
    color: #333;
    font-size: 2em;
}

nav {
    display: flex;
    gap: 10px;
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box h1 {
    font-size: 3em;
    margin-bottom: 10px;
}

.login-box h2 {
    color: #667eea;
    margin-bottom: 30px;
}

.login-links {
    margin-top: 20px;
}

.link {
    color: #667eea;
    text-decoration: none;
    font-size: 0.9em;
}

.link:hover {
    text-decoration: underline;
}

/* Messages */
.message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Forms */
.form-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.form-section h2 {
    color: #667eea;
    margin-bottom: 20px;
}

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

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

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    color: #333;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

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

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

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

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

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-large {
    padding: 15px 40px;
    font-size: 1.2em;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

/* Productos Grid */
.productos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.producto-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
}

.producto-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.producto-imagen {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.producto-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-image {
    color: #999;
    font-size: 1.2em;
}

.producto-info {
    padding: 20px;
}

.producto-info h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.producto-info p {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
}

.producto-cantidad {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.producto-cantidad label {
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
}

.cantidad-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #667eea;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
}

.producto-descripcion {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.producto-descripcion label {
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
}

.descripcion-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.9em;
    transition: border-color 0.3s;
}

.descripcion-input:focus {
    outline: none;
    border-color: #667eea;
}

.descripcion-input::placeholder {
    color: #999;
    font-style: italic;
}

.producto-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Producto Edit Row */
.producto-edit-row {
    display: grid;
    grid-template-columns: 2fr 1fr 2fr auto;
    gap: 15px;
    padding: 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
    align-items: end;
}

/* Pedidos */
.pedidos-section {
    margin-bottom: 40px;
}

.pedidos-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.pedidos-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.pedido-card {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    background: white;
    transition: all 0.3s;
}

.pedido-card.pendiente {
    border-left: 5px solid #ffc107;
}

.pedido-card.completado {
    border-left: 5px solid #28a745;
    opacity: 0.8;
}

.pedido-card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.pedido-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.pedido-header h3 {
    color: #667eea;
    font-size: 1.3em;
}

.pedido-fecha {
    color: #666;
    font-size: 0.9em;
}

.pedido-body p {
    margin-bottom: 10px;
    color: #333;
}

.pedido-productos {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.pedido-productos ul {
    list-style: none;
    margin-top: 10px;
}

.pedido-productos li {
    padding: 5px 0;
    color: #555;
    white-space: pre-line;
}

.pedido-productos li:before {
    content: "🍰 ";
    margin-right: 5px;
}

.pedido-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Historial */
.historial-section {
    margin-bottom: 40px;
}

.historial-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.historial-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.historial-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s;
}

.historial-item:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.historial-item.pendiente {
    border-left: 5px solid #ffc107;
}

.historial-item.completado {
    border-left: 5px solid #28a745;
}

.historial-item.entregado {
    border-left: 5px solid #6c757d;
    opacity: 0.7;
}

.historial-info {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.pedido-numero {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1em;
    min-width: 90px;
}

.pedido-fecha,
.pedido-cliente,
.pedido-telefono,
.pedido-productos-nombres,
.pedido-nota {
    color: #555;
    font-size: 0.95em;
}

.pedido-productos-nombres {
    color: #28a745;
    font-weight: 600;
}

.pedido-nota {
    color: #764ba2;
    font-style: italic;
}

.pedido-pagado {
    font-weight: 700;
    font-size: 0.9em;
    padding: 4px 10px;
    border-radius: 5px;
}

.pedido-pagado.pagado-si {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.pedido-pagado.pagado-no {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.pedido-importe {
    color: #28a745;
    font-weight: 700;
    font-size: 0.95em;
}

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

.no-products,
.no-pedidos {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.1em;
}

.auto-refresh {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 20px;
    }
    
    nav {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        width: 100%;
    }
    
    .productos-grid,
    .pedidos-list {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .producto-edit-row {
        grid-template-columns: 1fr;
    }
    
    .historial-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .historial-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .historial-actions {
        width: 100%;
        justify-content: flex-end;
    }
}