/* ============================================
   GLOBAL STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ff6b6b;
    --secondary-color: #4ecdc4;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --gray-color: #95a5a6;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   NAVIGATION BAR
   ============================================ */

.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-links a {
    text-decoration: none;
    color: var(--dark-color);
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
    background: rgba(255, 107, 107, 0.1);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #ff5252;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-secondary:hover {
    background: #45b8ad;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-logout {
    background: var(--danger-color);
    color: var(--white);
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.btn-logout:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* Email Button Navigation */
.email-btn-nav {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.5rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.email-btn-nav:hover {
    transform: scale(1.15);
    color: var(--primary-color);
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */

.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* ============================================
   FORMS
   ============================================ */

.form-wrapper {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    margin: 2rem auto;
}

.form-wrapper h1 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: var(--gray-color);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
    padding: 0.75rem;
    border: 2px solid var(--light-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.error-message {
    color: var(--danger-color);
    font-size: 0.85rem;
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    color: var(--success-color);
    font-size: 0.95rem;
    display: none;
    text-align: center;
}

.success-message.show {
    display: block;
}

.form-footer {
    text-align: center;
    color: var(--gray-color);
}

.form-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.form-footer a:hover {
    color: #ff5252;
    text-decoration: underline;
}

/* ============================================
   DEMO SECTION
   ============================================ */

.demo-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--light-color);
    background: rgba(255, 107, 107, 0.05);
    padding: 1.5rem;
    border-radius: var(--border-radius);
}

.demo-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.demo-section p {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--dark-color);
}

.demo-section .btn {
    margin-right: 0.5rem;
    margin-top: 0.5rem;
    width: 100%;
}

@media (max-width: 480px) {
    .demo-section .btn {
        margin-right: 0;
    }
}

/* ============================================
   PRODUCTS PAGE
   ============================================ */

.products-header {
    text-align: center;
    margin-bottom: 3rem;
}

.products-header h1 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.cart-info {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.cart-info span {
    color: var(--dark-color);
    font-weight: 600;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.product-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--light-color);
}

.product-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.product-description {
    color: var(--gray-color);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.product-actions {
    display: flex;
    gap: 0.5rem;
}

.add-to-cart-btn {
    flex: 1;
    padding: 0.75rem;
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.add-to-cart-btn:hover {
    background: #45b8ad;
}

.delete-product-btn {
    padding: 0.75rem 1rem;
    background: var(--danger-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.delete-product-btn:hover {
    background: #c0392b;
}

/* ============================================
   CART MODAL
   ============================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: var(--gray-color);
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close:hover {
    color: var(--dark-color);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

/* Email Modal Specific Styles */
.email-modal-content {
    max-width: 450px;
}

.email-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-color);
}

.email-icon {
    font-size: 2.5rem;
    animation: emailPulse 2s ease-in-out infinite;
}

@keyframes emailPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.email-modal-body {
    margin-bottom: 2rem;
}

.email-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.email-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--light-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.email-display span {
    flex: 1;
    color: var(--primary-color);
    font-weight: 600;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.btn-copy {
    background: var(--secondary-color);
    border: none;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    min-width: 40px;
}

.btn-copy:hover {
    background: #45b8ad;
    transform: scale(1.1);
}

.email-info {
    color: var(--gray-color);
    font-size: 0.9rem;
    line-height: 1.5;
}

.email-modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.email-modal-footer .btn {
    flex: 1;
    max-width: 200px;
}

.cart-items {
    margin-bottom: 1.5rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--light-color);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.cart-item-info {
    flex-grow: 1;
}

.cart-item-name {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
}

.cart-item-price {
    color: var(--gray-color);
    font-size: 0.9rem;
}

.cart-item-quantity {
    margin: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-btn {
    background: var(--light-color);
    border: none;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    font-weight: 600;
    transition: var(--transition);
}

.quantity-btn:hover {
    background: var(--primary-color);
    color: var(--white);
}

.remove-btn {
    background: var(--danger-color);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.remove-btn:hover {
    background: #c0392b;
}

.cart-total {
    text-align: right;
    padding: 1rem;
    background: var(--light-color);
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.empty-cart {
    text-align: center;
    padding: 2rem;
    color: var(--gray-color);
}

/* ============================================
   ADMIN DASHBOARD
   ============================================ */

.admin-header {
    text-align: center;
    margin-bottom: 3rem;
}

.admin-header h1 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.admin-section {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.admin-section h2 {
    color: var(--dark-color);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-color);
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.admin-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-form label {
    font-weight: 600;
    color: var(--dark-color);
}

.admin-form input,
.admin-form textarea {
    padding: 0.75rem;
    border: 2px solid var(--light-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.admin-form input:focus,
.admin-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.admin-products-list {
    display: grid;
    gap: 1.5rem;
}

.admin-product-item {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--light-color);
    border-radius: var(--border-radius);
    align-items: flex-start;
}

.admin-product-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--border-radius);
    background: var(--white);
}

.admin-product-details {
    flex-grow: 1;
}

.admin-product-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.admin-product-price {
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.admin-product-description {
    color: var(--gray-color);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.admin-product-actions {
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   PROFILE PAGE
   ============================================ */

.profile-wrapper {
    max-width: 800px;
    margin: 2rem auto;
}

.profile-wrapper h1 {
    text-align: center;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.profile-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.profile-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.profile-avatar {
    font-size: 3rem;
    background: rgba(255, 255, 255, 0.2);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-info h2 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.profile-email {
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.profile-role {
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.2);
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
}

.profile-details {
    padding: 2rem;
    border-bottom: 1px solid var(--light-color);
}

.detail-group {
    margin-bottom: 1.5rem;
}

.detail-group:last-child {
    margin-bottom: 0;
}

.detail-group label {
    display: block;
    font-weight: 600;
    color: var(--gray-color);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-group p {
    color: var(--dark-color);
    font-size: 1.1rem;
}

.profile-actions {
    padding: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.profile-actions .btn {
    flex: 1;
    min-width: 150px;
}

.cart-history {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: var(--shadow);
}

.cart-history h3 {
    color: var(--dark-color);
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-color);
}

#orderMessage {
    color: var(--gray-color);
    text-align: center;
    padding: 2rem 0;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .nav-container {
        padding: 1rem;
    }

    .nav-links {
        gap: 1rem;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
    }

    .form-wrapper {
        padding: 2rem;
        margin: 1rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1.5rem;
    }

    .product-image {
        height: 150px;
    }

    .admin-product-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .admin-product-image {
        width: 150px;
        height: 150px;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }

    .profile-actions {
        flex-direction: column;
    }

    .profile-actions .btn {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .cart-info {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .form-wrapper {
        padding: 1.5rem;
        margin: 1rem auto;
        max-width: 100%;
    }

    .logo {
        font-size: 1.2rem;
    }

    .nav-links {
        gap: 0.5rem;
    }

    .nav-links a {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
    }

    .cart-info {
        flex-direction: column;
        gap: 1rem;
    }

    .cart-info span {
        width: 100%;
        text-align: center;
    }

    .cart-info .btn {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .admin-section {
        padding: 1.5rem;
    }

    .profile-header {
        padding: 1rem;
    }

    .profile-avatar {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }

    .admin-product-actions {
        flex-direction: column;
        width: 100%;
    }

    .admin-product-actions .btn,
    .admin-product-actions .delete-product-btn {
        width: 100%;
    }
}
