@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --dark: #0f172a;
    --gray: #64748b;
    --light-gray: #f1f5f9;
    --bg: #f8fafc;
    --white: #ffffff;
    --danger: #ef4444;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    
    --transition: all 0.2s ease-in-out;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--dark);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* Layout */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
}

main {
    flex: 1;
    padding: 2rem 0;
}

/* Header & Navbar */
header {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 1rem 0;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.025em;
}

.navbar-brand span {
    color: var(--dark);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--gray);
    font-weight: 500;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--dark);
    border-color: #cbd5e1;
}

.btn-secondary:hover {
    background-color: var(--light-gray);
}

.btn-danger {
    background-color: var(--danger);
    color: var(--white);
}

/* Pagination Links */
.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    text-decoration: none;
    border: 1px solid #e2e8f0;
    color: var(--dark);
    background-color: var(--white);
    opacity: 0.9;
}

.pagination-link:hover {
    background-color: var(--light-gray);
    color: var(--primary);
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.pagination-link.active {
    background-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    pointer-events: none;
    opacity: 1;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    background-color: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Card Structure */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 1.5rem 1.5rem 0;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background-color: var(--light-gray);
    border-top: 1px solid #e2e8f0;
}

/* Listings Grid */
.listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(max(210px, calc(16.666% - 1.5rem)), 1fr));
    gap: 1.5rem;
}

.listing-card {
    display: flex;
    flex-direction: column;
}

.listing-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background-color: var(--light-gray);
}

.listing-content {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.listing-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.listing-title {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
}

.listing-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark);
    margin-top: auto;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #34d399;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
}

/* Footer */
footer {
    background: var(--white);
    border-top: 1px solid #e2e8f0;
    padding: 2rem 0;
    margin-top: auto;
    text-align: center;
    color: var(--gray);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
th {
    background-color: var(--light-gray);
    font-weight: 600;
    color: var(--dark);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25em 0.6em;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 9999px;
}
.badge-active {
    background-color: #dcfce7;
    color: #166534;
}
.badge-sold {
    background-color: #fee2e2;
    color: #ef4444;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid #fca5a5;
    text-transform: uppercase;
}

/* Smooth Sidebar Accordion */
.category-menu-wrapper {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}
.cat-item {
    border-bottom: 1px solid var(--light-gray);
}
.cat-item:last-child {
    border-bottom: none;
}
.cat-parent {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.2rem;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    transition: var(--transition);
    color: var(--dark);
}
.cat-parent:hover {
    background: var(--light-gray);
    color: var(--primary);
}
.cat-parent svg {
    transition: transform 0.3s ease;
    width: 20px;
    height: 20px;
    color: var(--gray);
}
.cat-item.active .cat-parent {
    color: var(--primary);
    font-weight: 600;
    background: #f8fafc;
}
.cat-item.active .cat-parent svg {
    transform: rotate(180deg);
    color: var(--primary);
}
.cat-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1);
    background: #f8fafc;
}
.cat-item.active .cat-children {
    max-height: 1000px;
    transition: max-height 0.6s ease-in-out;
}
.cat-child-link {
    display: block;
    padding: 0.5rem 1.2rem 0.5rem 2rem;
    color: var(--gray);
    font-size: 0.9em;
    position: relative;
    transition: var(--transition);
}
.cat-child-link:hover {
    color: var(--primary);
    background: #f1f5f9;
}
.cat-child-link::before {
    content: '';
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #cbd5e1;
    transition: var(--transition);
}
.cat-child-link:hover::before {
    background: var(--primary);
    transform: translateY(-50%) scale(1.5);
}
