/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f3f4f6;
    color: #1f2937;
    -webkit-font-smoothing: antialiased;
}

.hidden-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Sidebar */
.sidebar {
    width: 256px;
    min-height: 100vh;
    background-color: #1e40af;
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    padding: 24px;
}

.sidebar-logo {
    margin-bottom: 24px;
}

.sidebar-logo img {
    width: 100%;
    height: auto;
    object-fit: contain;
    background-color: white;
    padding: 8px;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 8px;
}

.sidebar-nav a {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    color: white;
    text-decoration: none;
    transition: background-color 0.2s;
}

.sidebar-nav a:hover {
    background-color: #2563eb;
}

.sidebar-nav a.active {
    background-color: #1e3a8a;
}

/* Main Content */
.main-content {
    margin-left: 256px;
    min-height: 100vh;
}

/* Navbar */
.navbar {
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.navbar-content {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.navbar-subtitle {
    font-size: 14px;
    color: #6b7280;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-status {
    font-size: 14px;
    color: #4b5563;
}

/* Content Area */
.content-area {
    padding: 16px;
}

/* Dashboard */
.dashboard-container {
    max-width: 1280px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.dashboard-header h2 {
    font-size: 30px;
    font-weight: 700;
}

.dashboard-subtitle {
    font-size: 14px;
    color: #6b7280;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.empty-state {
    padding: 24px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    color: #6b7280;
    text-align: center;
}

/* Item Card */
.item-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.item-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(to right, white, #f9fafb);
}

.item-card-info {
    flex: 1;
}

.item-name {
    font-weight: 500;
    font-size: 18px;
}

.item-description {
    font-size: 14px;
    color: #4b5563;
    margin-top: 4px;
}

.item-meta {
    font-size: 14px;
    color: #4b5563;
    margin-top: 4px;
}

.item-hsn {
    margin-left: 16px;
}

.item-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
}

.item-card-details {
    padding: 16px;
    background-color: white;
    border-top: 1px solid #e5e7eb;
}

.item-summary {
    background-color: #dbeafe;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #93c5fd;
    margin-bottom: 16px;
}

.summary-text {
    font-size: 14px;
    font-weight: 500;
    color: #1e3a8a;
}

.summary-subtext {
    font-size: 12px;
    color: #2563eb;
    margin-top: 4px;
}

/* Size Card */
.size-card {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    background-color: #f9fafb;
    margin-bottom: 16px;
}

.size-header {
    margin-bottom: 8px;
}

.size-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.size-name {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.size-weight {
    font-size: 14px;
    color: #6b7280;
    margin-left: 8px;
}

.size-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.size-details {
    margin-top: 12px;
}

.size-info {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 8px;
}

.size-contribution {
    margin-left: 8px;
    color: #059669;
}

/* Group Card */
.group-card {
    background-color: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    margin-bottom: 8px;
}

.group-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.group-info div {
    font-size: 14px;
}

.group-actions {
    display: flex;
    gap: 8px;
}

.add-size-section {
    margin-top: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transform: translateY(0);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(to right, #2563eb, #4f46e5);
    color: white;
    border-color: transparent;
}

.btn-primary:hover {
    background: linear-gradient(to right, #1d4ed8, #4338ca);
}

.btn-outline {
    background-color: white;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.btn-outline:hover {
    background-color: #eff6ff;
    border-color: #93c5fd;
}

.btn-ghost {
    background-color: transparent;
    color: #2563eb;
    box-shadow: none;
}

.btn-ghost:hover {
    background-color: #eff6ff;
}

.btn-danger {
    background-color: #dc2626;
    color: white;
    border-color: transparent;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

/* Login/Signup */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, white, #f3f4f6);
    padding: 24px;
}

.login-form {
    background-color: white;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 448px;
}

.login-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
}

.login-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 8px;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

.login-header p {
    font-size: 14px;
    color: #6b7280;
}

.error-message {
    color: #dc2626;
    margin-bottom: 12px;
    font-size: 14px;
}

.success-message {
    background-color: #10b981;
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.success-message::before {
    content: "✓";
    font-size: 18px;
    font-weight: bold;
}

.form-label {
    display: block;
    font-size: 14px;
    color: #374151;
    margin-bottom: 4px;
}

.form-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 14px;
}

.form-input:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-color: #3b82f6;
}

.form-textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.form-textarea:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-color: #3b82f6;
}

.form-select {
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background-color: white;
}

.form-select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-color: #3b82f6;
}

.login-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
}

.login-link {
    font-size: 14px;
    color: #2563eb;
    text-decoration: none;
}

.login-link:hover {
    text-decoration: underline;
}

/* Add Item */
.add-item-container {
    padding: 16px 24px;
}

.add-item-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 16px 24px;
    max-width: 1280px;
    margin: 0 auto;
}

.add-item-card h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

.add-item-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
    align-items: start;
}

.form-grid .form-label {
    grid-column: span 3;
    padding-top: 8px;
}

.form-grid > div:not(.form-label) {
    grid-column: span 9;
}

.quantity-input-group {
    display: flex;
    gap: 12px;
}

.quantity-input-group .form-input {
    flex: 1;
    margin-bottom: 0;
}

.quantity-input-group .form-select {
    width: 128px;
}

.sizes-section {
    margin-top: 24px;
}

.sizes-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.sizes-header h3 {
    font-weight: 600;
    font-size: 18px;
}

.sizes-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.size-row {
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background-color: #f9fafb;
}

.size-row-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.size-row-grid > div {
    grid-column: span 6;
}

.size-row-grid > div:nth-child(2) {
    grid-column: span 3;
}

.size-row-grid > div:nth-child(3) {
    grid-column: span 2;
}

.size-row-grid > div:nth-child(4) {
    grid-column: span 1;
}

.groups-section {
    margin-top: 16px;
}

.group-row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.group-row > div {
    grid-column: span 3;
}

.group-row > div:nth-child(4) {
    grid-column: span 2;
}

.group-row > div:nth-child(5) {
    grid-column: span 1;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end;
    padding-top: 16px;
}

@media (min-width: 640px) {
    .form-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
    
    .sizes-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* Inline Forms in Dashboard */
.inline-form {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
}

.inline-form h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1f2937;
}

.form-grid-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.form-grid-inline .form-label {
    display: none; /* placeholders act as labels for compact inline UI */
}

.form-grid-inline > input,
.form-grid-inline > .quantity-input-group,
.form-grid-inline > select {
    flex: 1 1 0;
    margin-bottom: 0;
}
 
.form-actions-inline {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: flex-end;
}

.size-edit-form,
.group-edit-form,
.add-plate-form,
.add-size-form {
    margin-top: 12px;
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

/* ============================== */
/* Responsive tweaks for mobile   */
/* ============================== */

@media (max-width: 991.98px) {
    /* Sidebar: full-width block at top */
    .sidebar {
        position: static;
        width: 100%;
        min-height: auto;
        padding: 16px;
    }

    /* Main content: full width */
    .main-content {
        margin-left: 0;
    }

    /* Navbar: stack nicely */
    .navbar-content {
        padding: 0 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .navbar-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .navbar-title {
        font-size: 18px;
    }

    .navbar-subtitle {
        font-size: 13px;
    }

    .navbar-right {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
    }
}
/* ========================================= */
/* Responsive layout for Dashboard/Add Item  */
/* ========================================= */

/* Tablet & below: keep existing sidebar/nav tweaks here if you like */

/* Phones & small screens */
@media (max-width: 767.98px) {

    /* ---------- Dashboard header ---------- */
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .dashboard-header h2 {
        font-size: 24px;
    }

    .dashboard-subtitle {
        font-size: 13px;
    }

    /* ---------- Item cards on dashboard ---------- */
    .item-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .item-card-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
        margin-left: 0;
        margin-top: 8px;
    }

    .item-card-actions .btn {
        flex: 0 1 auto;
    }

    /* Summary & size cards */
    .item-summary {
        font-size: 13px;
    }

    .size-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .size-actions {
        flex-wrap: wrap;
        gap: 6px;
    }

    .group-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .group-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .group-info div {
        font-size: 13px;
    }

    /* ---------- Add Item page: main card & form ---------- */
    .add-item-container {
        padding: 12px;
    }

    .add-item-card {
        padding: 16px;
    }

    /* Turn labels/fields into single column */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .form-grid .form-label {
        grid-column: 1 / -1;
        padding-top: 0;
    }

    .form-grid > div:not(.form-label) {
        grid-column: 1 / -1;
    }

    .quantity-input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    /* Size rows (in Add Item) */
    .size-row-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .size-row-grid > div {
        grid-column: 1 / -1 !important;
    }

    /* Group rows (plate rows in Add Item) */
    .group-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .group-row > div {
        grid-column: 1 / -1 !important;
    }

    /* Form actions (Save / Reset buttons) */
    .form-actions {
        width: 100%;
        align-items: stretch;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    /* Inline forms (edit plate / edit size / add plate/size) */
    .inline-form {
        padding: 12px;
    }

    .form-grid-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-grid-inline > input,
    .form-grid-inline > .quantity-input-group,
    .form-grid-inline > select {
        width: 100%;
    }

    .form-actions-inline {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .form-actions-inline .btn {
        flex: 0 1 auto;
    }
}
