﻿/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@font-face {
    font-family: 'Inter';
    src: url('/fonts/Inter-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Inter';
    src: url('/fonts/Inter-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
}

/* ==================== PAGE CONTAINER ==================== */
.config-page {
    padding: 16px;
    padding-left: 0;
    padding-bottom: 160px; /* Extra space so dropdowns remain scrollable even on short pages */
    font-family: 'Inter', sans-serif;
    position: relative;
}

/* ==================== BREADCRUMB ==================== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 20px;
    margin-bottom: 16px;
    margin-right: 16px;
}

.breadcrumb-home-icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.breadcrumb-text {
    font-family: Inter, sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    color: #4B5563;
}

.breadcrumb-arrow {
    width: 14px;
    height: 14px;
    opacity: 0.5;
}

.breadcrumb-link {
    font-family: Inter, sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    color: #4B5563;
    text-decoration: none;
    cursor: pointer;
}

.breadcrumb-link:hover {
    text-decoration: underline;
}

.breadcrumb-current {
    color: #4B5563;
}

/* ==================== PAGE HEADER ==================== */
.page-header {
    margin-bottom: 16px;
    margin-right: 16px;
}

.page-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.page-title {
    font-family: Inter, sans-serif;
    font-weight: 500;
    font-size: 18px;
    line-height: 27px;
    color: #000000;
    margin: 0;
    outline: none;
}

.info-icon {
    width: 18px;
    height: 18px;
    opacity: 0.6;
    cursor: pointer;
}

.page-description {
    font-family: Inter, sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    color: #6B7280;
    margin: 0;
}

/* ==================== SEARCH AND CATEGORY CONTAINER ==================== */
.search-category-container {
    width: 100%;
    max-width: 1418px;
    min-height: 77px;
    background: #FFFFFF;
    border-radius: 12px;
    border-top: 0.63px solid rgba(229, 231, 235, 0.5);
    box-shadow: 0px 1px 2px -1px rgba(0, 0, 0, 0.1), 0px 1px 3px 0px rgba(0, 0, 0, 0.1);
    padding: 12.62px 12.62px 12.62px 12.62px;
    margin-bottom: 16px;
    margin-right: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
}

.search-category-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-label {
    font-family: Inter, sans-serif;
    font-weight: 500;
    font-size: 12px;
    line-height: 16px;
    color: #374151;
}

.search-input-wrapper {
    position: relative;
    width: 296px;
    height: 36px;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    opacity: 0.5;
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 100%;
    padding: 4px 12px 4px 32px;
    font-family: Inter, sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #111827;
    background: #F9FAFB;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.search-input:focus,
.search-input-wrapper:focus-within .search-input {
    outline: none;
}

.search-input::placeholder {
    color: #9CA3AF;
}

.category-dropdown-wrapper {
    position: relative;
    width: 296px;
    height: 40px;
}

.category-dropdown {
    width: 100%;
    height: 100%;
    padding: 0 12px;
    font-family: Inter, sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #111827;
    background: #F9FAFB;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.category-dropdown:hover {
    /*border-color: #9CA3AF;*/
}

.category-dropdown:focus,
.category-dropdown-wrapper:focus-within .category-dropdown {
    outline: none;
}

.category-selected-text {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-badge {
    background: #FFFFFF;
    border: 1px solid #D1D5DB;
    color: #111827;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    line-height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
}

.dropdown-chevron {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.dropdown-chevron.rotated {
    transform: rotate(180deg);
}

.category-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: #FFFFFF;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1), 0px 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 100;
    padding: 8px 0;
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.category-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-family: Inter, sans-serif;
    font-size: 14px;
    color: #374151;
    transition: background-color 0.15s ease;
}

.category-option:hover {
    background-color: #F3F4F6;
}

.category-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #083050;
    cursor: pointer;
}

.config-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.cancel-button {
    width: 104px;
    height: 35px;
    padding: 0;
    background: #FFFFFF;
    border: 1.88px solid #E5E7EB;
    border-radius: 8px;
    font-family: Inter, sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    color: #111827;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0px 10px 30px 0px #00000014;
    transition: all 0.2s ease;
}

.cancel-button:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
}

.save-button {
    width: 108px;
    height: 36px;
    padding: 0;
    background: #083050;
    border: none;
    border-radius: 8px;
    font-family: Inter, sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    color: #FFFFFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0px 10px 18px 0px #00000014;
    transition: all 0.2s ease;
}

.save-button:hover:not(:disabled) {
    background: #0a4068;
}

.save-button:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
    opacity: 0.6;
}

.button-icon {
    width: 16px;
    height: 16px;
}

/* ==================== TABLE ==================== */
.config-table {
    width: 100%;
    max-width: 1416px;
    background: #FFFFFF;
    border: 0.63px solid #D1D5DB;
    border-radius: 8px;
    box-shadow: 0px 4px 6px -4px rgba(0, 0, 0, 0.1), 0px 10px 15px -3px rgba(0, 0, 0, 0.1);
    overflow: visible;
    margin-right: 16px;
    margin-bottom: 24px; /* Space at bottom for scrolling */
}

.table-header {
    display: flex;
    background-color: #F2F2F7;
    border-bottom: 1px solid #E5E7EB;
    padding: 12px 16px;
    min-height: 50px;
    align-items: center;
}

.table-header .table-cell {
    font-family: Inter, sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    color: #374151;
}

.table-body {
    /* No max-height - page scrolls instead of table */
}

.table-row {
    display: flex;
    border-bottom: 1px solid #E5E7EB;
    background-color: white;
    padding: 12px 16px;
    transition: background-color 0.15s ease;
}

.table-row:hover {
    background-color: #F9FAFB;
}

.table-row:last-child {
    border-bottom: none;
}

.table-cell {
    display: flex;
    align-items: center;
    padding: 0 8px;
}

.description-col {
    flex: 0 0 35%;
    min-width: 200px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.value-col {
    flex: 0 0 40%;
    min-width: 180px;
    justify-content: flex-start;
    gap: 8px;
}

.category-col {
    flex: 0 0 25%;
    min-width: 120px;
    justify-content: center;
}

.row-title {
    font-family: Inter, sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    color: #111827;
    margin: 0;
    padding: 0;
}

.config-subtext {
    font-family: Inter, sans-serif;
    font-weight: 400;
    font-size: 12px;
    line-height: 16px;
    color: #6B7280;
    margin-top: 2px;
}

/* ==================== INPUTS ==================== */
.config-input {
    width: 140px;
    height: 36px;
    padding: 8px 12px;
    font-family: Inter, sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #111827;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    background-color: #FFFFFF;
    box-sizing: border-box;
}

.config-input:focus {
    outline: none;
    border-color: #9CA3AF;
}

/* Time input - simple text display like Figma (24-hour format) */
.config-input.config-time {
    width: 80px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.config-input.config-time::placeholder {
    color: #9CA3AF;
    font-size: 12px;
}

.config-dropdown {
    width: 140px;
    height: 36px;
    padding: 8px 12px;
    font-family: Inter, sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #111827;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    background-color: #FFFFFF;
    appearance: none;
    background-image: url('/images/chevron-down.svg');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    cursor: pointer;
}

.config-dropdown:focus {
    outline: none;
    border-color: #9CA3AF;
}

.wide-dropdown {
    width: 320px;
    min-width: 200px;
    max-width: 100%;
}

.config-time {
    width: 100px;
}

.input-label {
    font-family: Inter, sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #6B7280;
}

.config-radio-group {
    display: flex;
    gap: 16px;
    align-items: center;
}

.config-radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: Inter, sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

.config-radio-group input[type="radio"] {
    accent-color: #1F2937;
    cursor: pointer;
}

/* ==================== CATEGORY TAGS ==================== */
.category-tag {
    padding: 4px 12px;
    border-radius: 6px;
    font-family: Inter, sans-serif;
    font-weight: 500;
    font-size: 13px;
    line-height: 16px;
    white-space: nowrap;
}

.category-rules {
    background-color: #EDE7FB80;
    color: #222222;
}

.category-setup {
    background-color: #FFF0BB;
    color: #222222;
}

/* ==================== UNSAVED CHANGES INDICATOR ==================== */
.unsaved-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px 8px 20px;
    background: #F59E0B;
    border: 1px solid rgba(251, 146, 60, 0.5);
    border-radius: 9999px;
    box-shadow: 0px 10px 15px -3px rgba(124, 45, 18, 0.1), 0px 4px 6px -4px rgba(124, 45, 18, 0.1);
    z-index: 9999;
    min-width: 337px;
    min-height: 50px;
    box-sizing: border-box;
}

.unsaved-indicator span {
    font-family: Inter, sans-serif;
    font-weight: 500;
    font-size: 13.6px;
    line-height: 24px;
    color: #FFFFFF;
    flex: 1;
}

.unsaved-icon {
    width: 18px;
    height: 18px;
}

.unsaved-indicator .save-btn {
    width: 78px;
    height: 32px;
    background: #FFFFFF;
    border: none;
    border-radius: 9999px;
    font-family: Inter, sans-serif;
    font-weight: 600;
    font-size: 11.9px;
    line-height: 20px;
    color: #EA580C;
    cursor: pointer;
    box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.unsaved-indicator .save-btn:hover {
    background: #FFF7ED;
}

.loading-message {
    padding: 40px;
    text-align: center;
    color: #6B7280;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* Inline Spinner */
.inline-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #E5E7EB;
    border-top: 3px solid #3B82F6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Banner - matches CommonApp style */
.error-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    margin-bottom: 16px;
    color: #856404;
    font-size: 14px;
    font-weight: 500;
}

.error-banner-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* ==================== TOAST MESSAGES ==================== */
.toast-message {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0px 10px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 10000;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.success-toast {
    background: #10B981;
}

.error-toast {
    background: #EF4444;
}

.validation-toast {
    background: #F59E0B;
}

.toast-message span {
    font-family: Inter, sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    color: #FFFFFF;
}

.toast-icon {
    width: 20px;
    height: 20px;
}

/* ==================== RESPONSIVE ==================== */

/* Extra large screens (1920px+) */
@media (min-width: 1920px) {
    .config-table,
    .search-category-container {
        margin-right: 300px;
    }
    
    .table-body {
        max-height: calc(100vh - 300px);
    }
}

/* Large screens (1440px - 1919px) */
@media (max-width: 1919px) and (min-width: 1440px) {
    .config-table,
    .search-category-container {
        margin-right: 250px;
    }
    
    .table-body {
        max-height: calc(100vh - 310px);
    }
}

/* Medium-large screens (1366px - 1439px) */
@media (max-width: 1439px) and (min-width: 1366px) {
    .config-table,
    .search-category-container {
        margin-right: 200px;
    }
    
    .search-input-wrapper {
        width: 240px;
    }
    
    .category-dropdown-wrapper {
        width: 240px;
    }
    
    .table-body {
        max-height: calc(100vh - 320px);
    }
    
    .description-col {
        flex: 0 0 32%;
        min-width: 180px;
    }
    
    .value-col {
        flex: 0 0 43%;
        min-width: 160px;
    }
    
    .category-col {
        flex: 0 0 25%;
        min-width: 100px;
    }
}

/* Medium screens (1200px - 1365px) */
@media (max-width: 1365px) and (min-width: 1200px) {
    .config-table,
    .search-category-container {
        margin-right: 150px;
    }
    
    .search-input-wrapper {
        width: 200px;
    }
    
    .category-dropdown-wrapper {
        width: 200px;
    }
    
    .config-input,
    .config-dropdown {
        width: 100px;
    }
    
    .wide-dropdown {
        width: 280px;
    }
    
    .table-body {
        max-height: calc(100vh - 320px);
    }
    
    .row-title {
        font-size: 13px;
    }
    
    .config-subtext {
        font-size: 11px;
    }
    
    .description-col {
        flex: 0 0 30%;
        min-width: 160px;
    }
    
    .value-col {
        flex: 0 0 45%;
        min-width: 150px;
    }
    
    .category-col {
        flex: 0 0 25%;
        min-width: 90px;
    }
}

/* Small-medium screens (1024px - 1199px) */
@media (max-width: 1199px) and (min-width: 1024px) {
    .config-table,
    .search-category-container {
        margin-right: 100px;
    }
    
    .search-input-wrapper {
        width: 180px;
    }
    
    .category-dropdown-wrapper {
        width: 180px;
    }
    
    .config-input,
    .config-dropdown {
        width: 90px;
        height: 32px;
        font-size: 13px;
    }
    
    .wide-dropdown {
        width: 240px;
    }
    
    .table-body {
        max-height: calc(100vh - 330px);
    }
    
    .row-title {
        font-size: 13px;
    }
    
    .config-subtext {
        font-size: 11px;
    }
    
    .category-tag {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .cancel-button,
    .save-button {
        height: 32px;
        font-size: 13px;
        padding: 0 12px;
    }
    
    .description-col {
        flex: 0 0 28%;
        min-width: 140px;
    }
    
    .value-col {
        flex: 0 0 47%;
        min-width: 140px;
    }
    
    .category-col {
        flex: 0 0 25%;
        min-width: 80px;
    }
}

/* Tablet screens (768px - 1023px) */
@media (max-width: 1023px) and (min-width: 768px) {
    .config-page {
        padding: 12px;
    }
    
    .config-table,
    .search-category-container {
        margin-right: 50px;
    }
    
    .search-category-container {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .search-category-row {
        flex-wrap: wrap;
    }
    
    .search-input-wrapper,
    .category-dropdown-wrapper {
        width: 100%;
        max-width: 280px;
    }
    
    .config-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .config-input,
    .config-dropdown {
        width: 80px;
        height: 30px;
        font-size: 12px;
    }
    
    .wide-dropdown {
        width: 200px;
    }
    
    .table-body {
        max-height: calc(100vh - 380px);
    }
    
    .page-title {
        font-size: 16px;
    }
    
    .page-description {
        font-size: 12px;
    }
    
    .row-title {
        font-size: 12px;
    }
    
    .config-subtext {
        font-size: 10px;
    }
    
    .category-tag {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .breadcrumb-text,
    .breadcrumb-link {
        font-size: 12px;
    }
}

/* Mobile screens (<768px) */
@media (max-width: 767px) {
    .config-page {
        padding: 8px;
    }
    
    .config-table,
    .search-category-container,
    .breadcrumb,
    .page-header {
        margin-right: 8px;
    }
    
    .search-category-container {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px;
    }
    
    .search-category-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-input-wrapper,
    .category-dropdown-wrapper {
        width: 100%;
    }
    
    .config-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .cancel-button,
    .save-button {
        flex: 1;
        justify-content: center;
        height: 36px;
        font-size: 12px;
    }
    
    .table-header,
    .table-row {
        padding: 10px 8px;
    }
    
    .description-col {
        flex: 1.5;
    }
    
    .value-col {
        flex: 1;
    }
    
    .category-col {
        flex: 0.8;
    }
    
    .config-input,
    .config-dropdown {
        width: 60px;
        height: 28px;
        font-size: 11px;
        padding: 4px 6px;
    }
    
    .wide-dropdown {
        width: 150px;
        font-size: 10px;
    }
    
    .table-body {
        max-height: calc(100vh - 400px);
    }
    
    .page-title {
        font-size: 14px;
    }
    
    .page-description {
        font-size: 11px;
    }
    
    .row-title {
        font-size: 11px;
    }
    
    .config-subtext {
        font-size: 9px;
    }
    
    .category-tag {
        font-size: 9px;
        padding: 2px 4px;
    }
    
    .breadcrumb-text,
    .breadcrumb-link {
        font-size: 11px;
    }
    
    .breadcrumb-arrow,
    .breadcrumb-home-icon {
        width: 10px;
        height: 10px;
    }
    
    .input-label {
        font-size: 11px;
    }
    
    .unsaved-indicator {
        bottom: 16px;
        right: 16px;
        padding: 6px 12px;
        min-width: auto;
        min-height: auto;
    }
    
    .unsaved-indicator span {
        font-size: 12px;
    }
}

/* ==================== TABLE LOADING STATE ==================== */
.table-loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    background-color: #ffffff;
    border-radius: 0 0 8px 8px;
}

