/* WineInventory - Custom Wine-Themed Design */

/* ============================================
   CSS Variables - Wine Color Palette
   ============================================ */
:root {
    /* Primary Colors */
    --wine-burgundy: #722F37;
    --wine-gold: #C9A961;
    --wine-cream: #F8F5F0;
    --wine-mahogany: #2C1810;
    --wine-accent: #8B4049;

    /* Semantic Colors */
    --primary-color: var(--wine-burgundy);
    --secondary-color: var(--wine-gold);
    --background-color: var(--wine-cream);
    --text-color: var(--wine-mahogany);
    --accent-color: var(--wine-accent);

    /* UI Colors */
    --border-color: rgba(114, 47, 55, 0.2);
    --hover-color: rgba(114, 47, 55, 0.1);
    --success-color: #26b050;
    --error-color: #c21b1b;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(44, 24, 16, 0.1);
    --shadow-md: 0 4px 8px rgba(44, 24, 16, 0.15);
    --shadow-lg: 0 8px 16px rgba(44, 24, 16, 0.2);
}

/* ============================================
   Base Styles
   ============================================ */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-color);
    background-color: var(--background-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Container - Sticky Footer Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: var(--spacing-md);
    line-height: 1.3;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

h1:focus {
    outline: none;
}

p {
    margin-top: 0;
    margin-bottom: var(--spacing-md);
}

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

a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* ============================================
   Hero Section (Landing Page)
   ============================================ */
.hero-section {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--wine-burgundy) 0%, var(--wine-mahogany) 100%);
    position: relative;
    overflow: hidden;
    padding: var(--spacing-xxl) var(--spacing-lg);
    min-height: 400px;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800"><path d="M0,400 Q300,200 600,400 T1200,400 L1200,800 L0,800 Z" fill="rgba(201,169,97,0.1)"/></svg>');
    background-size: cover;
    background-position: bottom;
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: var(--spacing-xl);
    max-width: 600px;
}

.hero-title {
    font-size: 3.5rem;
    color: white;
    margin-bottom: var(--spacing-lg);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: var(--spacing-xxl);
    font-family: 'Inter', sans-serif;
}

.hero-wine-icon {
    font-size: 5rem;
    margin-bottom: var(--spacing-lg);
}

/* ============================================
   Top Navigation Bar
   ============================================ */
.top-navbar {
    background-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.top-navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-lg);
}

.navbar-brand {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: white !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.navbar-brand:hover {
    color: var(--wine-gold) !important;
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-menu-item {
    margin: 0;
}

.navbar-link {
    color: rgba(255, 255, 255, 0.9) !important;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    text-decoration: none;
    font-weight: 500;
}

.navbar-link:hover,
.navbar-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white !important;
    text-decoration: none;
}

.navbar-user-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

/* Navbar specific button styling for better visibility */
.top-navbar .btn-outline {
    border-color: rgba(255, 255, 255, 0.8);
    color: white;
}

.top-navbar .btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: white;
    color: white;
}

/* Mobile Navigation Toggle */
.navbar-toggler {
    display: none;
    background: none;
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.5rem;
}

@media (max-width: 768px) {
    .navbar-toggler {
        display: block;
    }

    .navbar-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--primary-color);
        flex-direction: column;
        padding: var(--spacing-md);
        box-shadow: var(--shadow-md);
    }

    .navbar-menu.show {
        display: flex;
    }

    .navbar-menu-item {
        width: 100%;
    }

    .navbar-link {
        display: block;
        width: 100%;
    }
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
    width: 100%;
}

.page-header {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--border-color);
}

.page-title {
    margin-bottom: var(--spacing-sm);
}

.page-subtitle {
    color: rgba(44, 24, 16, 0.7);
    font-size: 1.1rem;
    margin: 0;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-family: inherit;
    line-height: 1.5;
    vertical-align: middle;
    box-sizing: border-box;
}

/* Ensure buttons and anchors render the same */
button.btn,
a.btn {
    display: inline-block;
    vertical-align: middle;
}

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

.btn-primary:hover {
    background-color: var(--accent-color);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: #B8975A;
    color: var(--text-color);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
}

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

.btn-danger:hover {
    background-color: #a01818;
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    padding: 0;
    text-decoration: underline;
}

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

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.875rem;
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1.125rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:focus, .btn:active:focus {
    box-shadow: 0 0 0 3px rgba(114, 47, 55, 0.3);
    outline: none;
}

/* ============================================
   Forms
   ============================================ */
.form-control {
    display: block;
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-color);
    background-color: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

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

.form-control::placeholder {
    color: rgba(44, 24, 16, 0.4);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--text-color);
}

.form-group,
.mb-3 {
    margin-bottom: var(--spacing-md);
}

select.form-control {
    cursor: pointer;
    height: calc(1.5em + var(--spacing-sm) * 2 + 4px); /* Match input height */
    box-sizing: border-box;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.valid.modified:not([type=checkbox]) {
    border-color: var(--success-color);
}

.invalid {
    border-color: var(--error-color);
}

.validation-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: var(--spacing-xs);
}

/* ============================================
   Cards & Tables
   ============================================ */
.card {
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--border-color);
}

.card-header {
    margin: calc(var(--spacing-lg) * -1) calc(var(--spacing-lg) * -1) var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    background-color: var(--hover-color);
    border-bottom: 2px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-lg);
    background-color: white;
}

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

.table th,
.table td {
    padding: var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: var(--hover-color);
}

.table-striped tbody tr:nth-child(odd) {
    background-color: rgba(248, 245, 240, 0.5);
}

/* Table button spacing - buttons side by side */
.table td .btn {
    display: inline-block !important;
    margin-right: var(--spacing-sm);
    margin-bottom: 0;
}

/* ============================================
   Utilities
   ============================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-3 { margin-top: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-md); }
.pt-3 { padding-top: var(--spacing-md); }
.pb-3 { padding-bottom: var(--spacing-md); }

.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: calc(var(--spacing-md) * -1);
    margin-right: calc(var(--spacing-md) * -1);
}

.col,
.col-md-6 {
    flex: 1;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}

@media (max-width: 768px) {
    .col-md-6 {
        flex: 0 0 100%;
    }
}

/* ============================================
   Blazor Loading & Error States
   ============================================ */
#blazor-error-ui {
    background: var(--error-color);
    color: white;
    bottom: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 1rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    border-top: 3px solid #a01818;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    opacity: 0.8;
}

#blazor-error-ui .dismiss:hover {
    opacity: 1;
}

.blazor-error-boundary {
    background: var(--error-color);
    padding: var(--spacing-lg);
    color: white;
    border-radius: var(--radius-md);
    margin: var(--spacing-lg) 0;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--primary-color);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    color: var(--primary-color);
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* ============================================
   Login Page Specific
   ============================================ */
.login-container {
    max-width: 400px;
    margin: 0 auto;
}

.login-card {
    background-color: white;
    padding: var(--spacing-xxl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.external-login-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
}

.divider {
    text-align: center;
    margin: var(--spacing-lg) 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background-color: var(--border-color);
}

.divider span {
    background-color: white;
    padding: 0 var(--spacing-md);
    position: relative;
    color: rgba(44, 24, 16, 0.6);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }

    .main-content {
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .table {
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: var(--spacing-sm);
    }
}

/* ============================================
   Admin Specific
   ============================================ */
.admin-section {
    background-color: rgba(114, 47, 55, 0.05);
    border-left: 4px solid var(--primary-color);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    border-radius: var(--radius-sm);
}

.admin-badge {
    background-color: var(--secondary-color);
    color: var(--text-color);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   Input Groups & Inline Forms
   ============================================ */
.input-group {
    display: flex;
    gap: var(--spacing-sm);
    align-items: flex-start;
}

.input-group .form-control {
    flex: 1;
}

.input-group .btn {
    flex-shrink: 0;
}

/* ============================================
   Footer
   ============================================ */
.app-footer {
    background-color: var(--primary-color);
    color: rgba(255, 255, 255, 0.9);
    padding: var(--spacing-xl) var(--spacing-lg);
    margin-top: var(--spacing-xxl);
    border-top: 3px solid var(--secondary-color);
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-xl);
}

.footer-section h4 {
    color: var(--secondary-color);
    font-size: 1.1rem;
    margin-bottom: var(--spacing-md);
}

.footer-section p,
.footer-section ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-section li {
    margin-bottom: var(--spacing-xs);
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--secondary-color);
    text-decoration: none;
}

.footer-bottom {
    max-width: 1400px;
    margin: var(--spacing-lg) auto 0;
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

@media (max-width: 768px) {
    .footer-container {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
}

/* ============================================
   Layout Utilities
   ============================================ */
.button-group {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.button-group-center {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

.flex-field {
    flex: 1;
}

/* ============================================
   Admin Forms
   ============================================ */
.admin-simple-form {
    max-width: 400px;
}

.admin-complex-form {
    display: flex;
    gap: var(--spacing-md);
    align-items: flex-end;
    max-width: 800px;
}

/* Admin table action column */
.table-actions-col {
    width: 220px;
}

/* ============================================
   Simple Header (for non-authenticated users)
   ============================================ */
.simple-header {
    background-color: var(--primary-color);
    color: white;
    padding: var(--spacing-md) 0;
    box-shadow: var(--shadow-md);
}

.simple-header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.simple-header-brand {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.simple-header-brand:hover {
    color: var(--secondary-color);
    text-decoration: none;
}

/* ============================================
   Auth Pages (Login/Register)
   ============================================ */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: var(--spacing-lg);
}

.auth-container > * {
    width: 100%;
    max-width: 500px;
}

.auth-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-xxl);
    box-shadow: var(--shadow-lg);
}

.auth-title {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    color: var(--primary-color);
}

.auth-divider {
    margin: var(--spacing-xl) 0;
    border: 0;
    border-top: 2px solid var(--border-color);
}

.btn-block {
    width: 100%;
    display: block;
}

/* ============================================
   Modal Dialog
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-dialog {
    width: 100%;
    max-width: 500px;
    margin: auto;
}

.modal-content {
    background-color: white;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    position: relative;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
}

.modal-header h5 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background-color: #f8f9fa;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}
