/* 
 * Main Stylesheet for "Fanavaran Forough Taha"
 * Minimal, modern, and responsive design tailored for metallurgy/chemical products.
 */

/* =========================================
   Variables & Fonts
   ========================================= */
@font-face {
    font-family: 'Sahel';
    src: url('../fonts/sahel.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

:root {
    --color-primary: #1a252f;    /* Deep slate/navy (Professional, industrial) */
    --color-secondary: #2c3e50;  /* Steel blue */
    --color-accent: #d35400;     /* Copper/Rust orange (Accent for CTA) */
    --color-accent-hover: #e67e22;
    --color-bg: #f8f9fa;         /* Light gray background */
    --color-surface: #ffffff;    /* White cards/boxes */
    --color-text: #333333;
    --color-text-muted: #7f8c8d;
    --color-border: #e0e0e0;
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
}

/* =========================================
   Reset & Base Styles
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Sahel', sans-serif;
    direction: rtl;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

ul {
    list-style: none;
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

main {
    flex: 1; /* Pushes footer to the bottom */
    padding: 40px 0;
}

/* =========================================
   Buttons
   ========================================= */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-surface);
}

.btn-primary:hover {
    background-color: var(--color-accent-hover);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--color-border);
    color: var(--color-text);
}

.btn-outline:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* =========================================
   Header & Navigation
   ========================================= */
.main-header {
    background-color: var(--color-surface);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.right-nav, .left-nav {
    display: flex;
    align-items: center;
    gap: 30px;
}

.site-logo {
    font-size: 20px;
    font-weight: bold;
    color: var(--color-primary);
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a:hover {
    color: var(--color-accent);
}

.user-actions {
    display: flex;
    gap: 10px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-primary);
}

/* =========================================
   Products Grid (index.php)
   ========================================= */
.section-title {
    margin-bottom: 30px;
    font-size: 24px;
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-accent);
    display: inline-block;
    padding-bottom: 5px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.product-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.product-cover {
    width: 100%;
    aspect-ratio: 1 / 1; /* Forces 1:1 square ratio */
    object-fit: cover;
    background-color: #eee; /* Placeholder bg */
}

.product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.product-title {
    font-size: 16px;
    color: var(--color-primary);
    margin-bottom: auto;
}

.product-price {
    font-size: 18px;
    font-weight: bold;
    color: var(--color-accent);
    text-align: left;
}

/* =========================================
   Footer
   ========================================= */
.main-footer {
    background-color: var(--color-primary);
    color: var(--color-surface);
    padding: 40px 0 20px;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    margin-bottom: 15px;
    color: var(--color-accent);
}

.footer-section p {
    color: #bdc3c7;
    font-size: 14px;
}

/* eNamad Placeholder */
.enamad-box {
    background-color: var(--color-surface);
    color: var(--color-text);
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: bold;
    border: 2px dashed var(--color-border);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 13px;
    color: #bdc3c7;
}

/* =========================================
   Static Pages (About, Contact, FAQ)
   ========================================= */
.page-content {
    background: var(--color-surface);
    padding: 30px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.page-content p {
    margin-bottom: 15px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 500px;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
}

.faq-item {
    margin-bottom: 15px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 15px;
}

.faq-question {
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 10px;
}

/* =========================================
   Responsive Design
   ========================================= */
@media (max-width: 768px) {
    .nav-links {
        display: none; /* Hide for mobile by default, handled by JS */
        flex-direction: column;
        position: absolute;
        top: 70px;
        right: 0;
        background: var(--color-surface);
        width: 100%;
        box-shadow: var(--shadow-sm);
        padding: 20px;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .mobile-menu-btn {
        display: block;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   Product Detail Page
   ========================================= */
.product-single {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 40px;
background: var(--color-surface);
padding: 30px;
border-radius: var(--radius-md);
box-shadow: var(--shadow-sm);
margin-bottom: 40px;
}

.product-single-image img {
width: 100%;
aspect-ratio: 1 / 1;
object-fit: cover;
border-radius: var(--radius-md);
border: 1px solid var(--color-border);
}

.product-single-meta {
display: flex;
flex-direction: column;
gap: 20px;
}

.product-single-title {
font-size: 28px;
color: var(--color-primary);
}

.product-single-price {
font-size: 24px;
font-weight: bold;
color: var(--color-accent);
}

.product-single-desc {
color: var(--color-text-muted);
line-height: 1.8;
}

/* Comments Section */
.comments-section {
background: var(--color-surface);
padding: 30px;
border-radius: var(--radius-md);
box-shadow: var(--shadow-sm);
}

.comment-list {
margin-top: 20px;
display: flex;
flex-direction: column;
gap: 15px;
}

.comment-box {
    padding: 15px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.comment-author {
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 5px;
    font-size: 14px;
}

.comment-text {
    color: var(--color-text);
    line-height: 1.6;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.comment-form textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    resize: vertical;
}

.comment-form .btn {
    align-self: flex-start;
}

/* =========================================
   Cart Page
   ========================================= */
.cart-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.cart-items-container {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cart-row {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--color-surface);
    padding: 15px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.cart-row-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.cart-row-info {
    flex: 1;
}

.cart-row-title {
    font-weight: bold;
    color: var(--color-primary);
    font-size: 16px;
}

.cart-qty-control {
    display: flex;
    align-items: center;
    gap: 5px;
}

.cart-qty-control input {
    width: 50px;
    text-align: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 5px;
    font-family: inherit;
}

.btn-remove {
    color: #e74c3c;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
}

.btn-remove:hover {
    text-decoration: underline;
}

.cart-row-total {
    font-weight: bold;
    color: var(--color-primary);
    width: 120px;
    text-align: center;
    flex-shrink: 0;
}


.cart-summary {
flex: 1;
background: var(--color-surface);
padding: 25px;
border-radius: var(--radius-md);
box-shadow: var(--shadow-sm);
position: sticky;
top: 90px;
}

.summary-row {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
font-size: 18px;
font-weight: bold;
}

/* =========================================
   User Panel
   ========================================= */
.panel-layout {
display: flex;
gap: 30px;
align-items: flex-start;
}

.panel-sidebar {
flex: 1;
background: var(--color-surface);
padding: 20px;
border-radius: var(--radius-md);
box-shadow: var(--shadow-sm);
}

.panel-user-info {
text-align: center;
margin-bottom: 20px;
padding-bottom: 20px;
border-bottom: 1px solid var(--color-border);
}

.panel-content {
flex: 3;
background: var(--color-surface);
padding: 30px;
border-radius: var(--radius-md);
box-shadow: var(--shadow-sm);
}

.order-card {
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
padding: 20px;
margin-bottom: 15px;
}

.order-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
padding-bottom: 10px;
border-bottom: 1px dashed var(--color-border);
}

/* Order Status Badges */
.status-badge {
padding: 5px 10px;
border-radius: 20px;
font-size: 12px;
font-weight: bold;
}
.status-packing { background-color: #f39c12; color: white; } /* Orange */
.status-post { background-color: #3498db; color: white; }    /* Blue */
.status-delivered { background-color: #2ecc71; color: white; } /* Green */

/* Responsive additions */
@media (max-width: 768px) {
    .product-single {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .cart-layout, .panel-layout {
        flex-direction: column;
    }

    /* This part is updated */
    .cart-row {
        flex-direction: column;
        text-align: center;
        align-items: center; /* This centers your items horizontally */
        gap: 15px; /* This adds some space between the stacked items */
    }
    
    .cart-row-total {
        width: auto; /* Let width be auto on mobile */
    }

        /* Additions for Cart and Panel on Mobile */
    .cart-items-container,
    .panel-content,
    .panel-sidebar {
        width: 100%;
    }

    .cart-summary {
        width: 100%;
        position: static; /* Disable sticky positioning on mobile */
    }

}

/* =========================================
   Login & Registration Page
   ========================================= */
.login-container {
    background-color: var(--color-surface);
    max-width: 400px;
    width: 90%; /* For mobile responsiveness */
    margin: 60px auto; /* Centers the box vertically and horizontally */
    padding: 30px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.login-container h2 {
    color: var(--color-primary);
    text-align: center;
    margin-bottom: 25px;
    font-size: 22px;
}

/* Alert Messages (Errors or Success) */
.login-container .alert {
    background-color: #fdf2e9; /* Very light tint of the accent color */
    color: var(--color-accent);
    border: 1px solid var(--color-accent);
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
    line-height: 1.5;
}

/* Form Layout */
.login-container form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-container label {
    font-size: 14px;
    color: var(--color-text);
    font-weight: bold;
}

.login-container input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 16px;
    transition: border-color 0.3s ease;
    
    /* Mobile numbers and OTPs are better typed LTR */
    direction: ltr; 
    text-align: left;
}

.login-container input[type="text"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1); /* Subtle focus ring */
}

/* Make the login button full width and slightly larger */
.login-container .btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: bold;
    margin-top: 10px;
}

/* Responsive adjustment for very small screens */
@media (max-width: 480px) {
    .login-container {
        margin: 30px auto;
        padding: 20px;
    }
}

/* =========================================
   Alerts & Notifications
   ========================================= */
.alert {
    padding: 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 25px;
    font-size: 14px;
    line-height: 1.6;
    text-align: right;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-warning a {
    color: var(--color-accent);
    font-weight: bold;
    text-decoration: none;
    border-bottom: 1px dashed var(--color-accent);
}

.alert-warning a:hover {
    color: var(--color-accent-hover);
    border-bottom-style: solid;
}

.no-comments {
    color: var(--color-text-muted);
    text-align: center;
    padding: 20px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px dashed var(--color-border);
    font-size: 14px;
}

