/* General Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-bg: #F5EFE0;
    --parchment-bg: #F7F2E0;
    --parchment-border: #D2B48C;
    --primary-text: #4A3728;
    --secondary-text: #725B3F;
    --accent-green: #91c400;
    --accent-red: #A52A2A;
    --accent-brown: #8B4513;
    --border-radius: 8px;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    --medieval-font: 'Cinzel Decorative', 'MedievalSharp', cursive;
    --body-font: 'Roboto', sans-serif;
}

body {
    font-family: var(--body-font);
    background-color: var(--primary-bg);
    color: var(--primary-text);
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23A52A2A' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1, h2, h3, h4 {
    font-family: var(--medieval-font);
    color: var(--accent-brown);
}

/* Header Styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 15px;
    background-color: var(--parchment-bg);
    border: 2px solid var(--parchment-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo {
    width: 60px;
    height: 60px;
    margin-right: 15px;
}

header h1 {
    font-size: 2rem;
    margin: 0;
}

#user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#user-name {
    font-weight: bold;
}

/* Parchment Section Styles */
.parchment {
    background-color: var(--parchment-bg);
    border: 2px solid var(--parchment-border);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    position: relative;
}

.parchment::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%238B4513' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
    opacity: 0.5;
    pointer-events: none;
    border-radius: var(--border-radius);
    z-index: 0;
}

.section {
    margin-bottom: 30px;
}

/* Medieval Button Styles */
.medieval-btn {
    font-family: var(--medieval-font);
    background-color: var(--accent-brown);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.medieval-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: all 0.6s ease;
}

.medieval-btn:hover::before {
    left: 100%;
}

.medieval-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.medieval-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.medieval-btn.green {
    background-color: var(--accent-green);
}

.medieval-btn.red {
    background-color: var(--accent-red);
}

/* Auth Section Styles */
.auth-container {
    max-width: 500px;
    margin: 0 auto;
}

.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--parchment-border);
}

.tab-btn {
    font-family: var(--medieval-font);
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--secondary-text);
    position: relative;
}

.tab-btn::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--accent-brown);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.tab-btn.active {
    color: var(--accent-brown);
    font-weight: bold;
}

.tab-btn.active::after {
    transform: scaleX(1);
}

.auth-form {
    padding: 20px 0;
}

.auth-form h2 {
    margin-bottom: 20px;
    text-align: center;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--secondary-text);
}

.input-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--parchment-border);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background-color: rgba(255, 255, 255, 0.7);
}

.auth-form button {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    font-size: 1.1rem;
}

/* Cliente Dashboard Styles */
.dashboard-header {
    margin-bottom: 25px;
    border-bottom: 2px solid var(--parchment-border);
    padding-bottom: 15px;
}

.dashboard-header h2 {
    font-size: 1.8rem;
    text-align: center;
}

.dashboard-content {
    position: relative;
    z-index: 1;
}

.points-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.welcome-message {
    margin-top: 15px;
    padding: 15px;
    background-color: rgba(145, 196, 0, 0.1);
    border-radius: var(--border-radius);
    border: 1px solid var(--accent-green);
    text-align: center;
    animation: fadeIn 0.6s ease-in-out;
}

.welcome-message p {
    font-weight: bold;
    margin: 5px 0;
    font-size: 1.1em;
}

.welcome-message span {
    color: var(--accent-green);
    font-size: 1.2em;
}

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

.medal {
    width: 150px;
    height: 150px;
    background-color: var(--accent-brown);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 15px rgba(139, 69, 19, 0.5);
    border: 5px solid #D2B48C;
    position: relative;
}

.medal::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 2px dashed #D2B48C;
    border-radius: 50%;
    opacity: 0.7;
}

#client-points {
    font-size: 3rem;
    font-weight: bold;
    line-height: 1;
    font-family: var(--medieval-font);
}

.points-label {
    font-size: 1.2rem;
    font-family: var(--medieval-font);
}

.progress-container {
    margin-bottom: 30px;
}

.progress-container h3 {
    margin-bottom: 15px;
    text-align: center;
}

.progress-bar-container {
    position: relative;
    width: 100%;
}

.progress-bar {
    height: 25px;
    background-color: rgba(210, 180, 140, 0.3);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    margin-bottom: 35px;
    border: 1px solid var(--parchment-border);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #73ad21, #91c400);
    border-radius: 15px;
    transition: width 1s ease-in-out;
}

.progress-icons {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.progress-icon {
    position: absolute;
    transform: translateY(-50%);
    top: 50px;
    width: 30px;
    height: 30px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--parchment-border);
}

.next-reward {
    text-align: right;
    font-weight: bold;
    margin-top: 10px;
}

#next-reward-name {
    color: var(--accent-green);
}

.promo-banner {
    display: flex;
    align-items: center;
    background-color: rgba(165, 42, 42, 0.1);
    border: 2px dashed var(--accent-red);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 30px;
    animation: glowing 2s infinite alternate;
}

@keyframes glowing {
    from { box-shadow: 0 0 5px rgba(165, 42, 42, 0.3); }
    to { box-shadow: 0 0 15px rgba(165, 42, 42, 0.6); }
}

.promo-icon {
    font-size: 2.5rem;
    margin-right: 15px;
}

.promo-content h3 {
    margin-bottom: 5px;
    color: var(--accent-red);
}

.referral-container {
    background-color: rgba(255, 255, 255, 0.5);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    border: 1px solid var(--parchment-border);
}

.referral-container h3 {
    margin-bottom: 15px;
}

.referral-code {
    display: flex;
    align-items: center;
    background-color: white;
    padding: 10px 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--parchment-border);
    margin-bottom: 20px;
}

#referral-code {
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 1px;
    flex-grow: 1;
    font-family: monospace;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary-text);
    padding: 5px;
    transition: color 0.3s ease;
}

.icon-btn:hover {
    color: var(--accent-brown);
}

.share-buttons h3 {
    margin-bottom: 10px;
}

.social-buttons {
    display: flex;
    gap: 10px;
}

.social-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.social-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.whatsapp {
    background-color: #25D366;
}

.facebook {
    background-color: #1877F2;
}

.instagram {
    background-color: #E4405F;
}

.email {
    background-color: #D44638;
}

.rewards-container, .history-container {
    margin-top: 30px;
}

.rewards-container h3, .history-container h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--parchment-border);
}

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

.reward-card {
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--parchment-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.reward-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.reward-header {
    background-color: var(--accent-brown);
    color: white;
    padding: 15px;
    font-family: var(--medieval-font);
}

.reward-header h4 {
    margin: 0;
    font-size: 1.2rem;
    color: white;
}

.reward-body {
    padding: 15px;
}

.reward-description {
    margin-bottom: 15px;
    color: var(--secondary-text);
}

.reward-points {
    font-weight: bold;
    color: var(--accent-brown);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.reward-footer {
    padding: 15px;
    background-color: rgba(210, 180, 140, 0.1);
    border-top: 1px solid var(--parchment-border);
}

.activity-list {
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--parchment-border);
}

.activity-item {
    padding: 15px;
    border-bottom: 1px solid var(--parchment-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-info {
    flex-grow: 1;
}

.activity-title {
    font-weight: bold;
    color: var(--primary-text);
    margin-bottom: 5px;
}

.activity-date {
    font-size: 0.9rem;
    color: var(--secondary-text);
}

.activity-points {
    font-weight: bold;
    color: var(--accent-green);
}

.activity-points.negative {
    color: var(--accent-red);
}

/* Restaurante Dashboard Styles */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--parchment-border);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--secondary-text);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent-brown);
    font-family: var(--medieval-font);
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background-color: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--parchment-border);
    padding: 20px;
    box-shadow: var(--shadow);
}

.chart-card h3 {
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2rem;
}

.clients-table-container, .rewards-history-container {
    margin-top: 30px;
}

.table-responsive {
    overflow-x: auto;
}

.medieval-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.medieval-table th {
    background-color: var(--accent-brown);
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-family: var(--medieval-font);
}

.medieval-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--parchment-border);
}

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

.medieval-table tbody tr:hover {
    background-color: rgba(210, 180, 140, 0.1);
}

.assign-points-container {
    background-color: rgba(255, 255, 255, 0.5);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    border: 1px solid var(--parchment-border);
}

.assign-points-container h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--parchment-border);
    text-align: center;
}

.currency-input {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: 10px;
    font-weight: bold;
    color: var(--secondary-text);
    pointer-events: none;
}

.currency-input input {
    padding-left: 25px;
}

.calculated-points {
    margin: 15px 0;
    font-size: 1.2rem;
    text-align: center;
    font-weight: bold;
}

#calculated-points {
    color: var(--accent-green);
    font-family: var(--medieval-font);
    font-size: 1.5rem;
}

/* Admin Dashboard Styles */
.admin-tabs {
    display: flex;
    border-bottom: 2px solid var(--parchment-border);
    margin-bottom: 25px;
    overflow-x: auto;
    white-space: nowrap;
}

.admin-tab-btn {
    font-family: var(--medieval-font);
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--secondary-text);
    position: relative;
}

.admin-tab-btn::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--accent-brown);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.admin-tab-btn.active {
    color: var(--accent-brown);
    font-weight: bold;
}

.admin-tab-btn.active::after {
    transform: scaleX(1);
}

.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-section-header h3 {
    margin: 0;
}

.settings-section {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid var(--parchment-border);
}

.settings-section h4 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--parchment-border);
}

#add-equivalence-btn {
    margin-top: 15px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--parchment-border);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary-text);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--parchment-border);
}

.reward-details {
    text-align: center;
    margin-bottom: 20px;
}

.reward-cost {
    font-weight: bold;
    margin-top: 10px;
    color: var(--accent-brown);
    font-size: 1.2rem;
}

#reward-points {
    font-size: 1.5rem;
}

.confirmation-message {
    background-color: rgba(210, 180, 140, 0.1);
    padding: 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--parchment-border);
}

.success-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.success-icon {
    margin-bottom: 15px;
}

.redemption-code {
    text-align: center;
}

.code-display {
    background-color: white;
    padding: 15px;
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 2px;
    margin: 15px 0;
    border-radius: var(--border-radius);
    border: 1px solid var(--parchment-border);
    font-family: monospace;
}

.code-instructions {
    color: var(--secondary-text);
    font-size: 0.9rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        text-align: center;
    }
    
    .logo-container {
        margin-bottom: 15px;
    }
    
    .stats-container, .charts-container {
        grid-template-columns: 1fr;
    }
    
    .admin-tabs {
        flex-wrap: wrap;
    }
    
    .admin-tab-btn {
        flex-grow: 1;
        text-align: center;
    }
    
    .admin-section-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-content {
        width: 95%;
    }
}

@media (max-width: 480px) {
    .social-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .reward-card {
        min-width: 100%;
    }
    
    .medal {
        width: 120px;
        height: 120px;
    }
    
    #client-points {
        font-size: 2.5rem;
    }
    
    .progress-icon {
        width: 25px;
        height: 25px;
    }
    
    .progress-bar {
        margin-bottom: 45px;
    }
}