/* Amazon Ember Font */
@font-face {
    font-family: 'Amazon Ember';
    src: url('https://d2c87l0yth4zbw-cloudfront.net/fonts/AmazonEmber_W_Rg.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'Amazon Ember';
    src: url('https://d2c87l0yth4zbw-cloudfront.net/fonts/AmazonEmber_W_Bd.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
}

/* CSS Variables */
:root {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e0e0e0;
    --modal-bg: #3d4a5c;
    --modal-text: #e2e8f0;
    
    /* Extended Color Palette - OKLCH */
    --color-red-200: oklch(88.5% .062 18.334);
    --color-red-300: oklch(80.8% .114 19.571);
    --color-red-400: oklch(70.4% .191 22.216);
    --color-red-500: oklch(63.7% .237 25.331);
    --color-red-600: oklch(57.7% .245 27.325);
    --color-red-700: oklch(50.5% .213 27.518);
    --color-red-900: oklch(39.6% .141 25.723);
    --color-orange-200: oklch(90.1% .076 70.697);
    --color-orange-300: oklch(83.7% .128 66.29);
    --color-orange-400: oklch(75% .183 55.934);
    --color-orange-500: oklch(70.5% .213 47.604);
    --color-orange-600: oklch(64.6% .222 41.116);
    --color-orange-700: oklch(55.3% .195 38.402);
    --color-orange-900: oklch(40.8% .123 38.172);
    --color-amber-400: oklch(82.8% .189 84.429);
    --color-amber-500: oklch(76.9% .188 70.08);
    --color-amber-600: oklch(66.6% .179 58.318);
    --color-amber-700: oklch(55.5% .163 48.998);
    --color-amber-950: oklch(27.9% .077 45.635);
    --color-yellow-300: oklch(90.5% .182 98.111);
    --color-yellow-400: oklch(85.2% .199 91.936);
    --color-yellow-600: oklch(68.1% .162 75.834);
    --color-yellow-700: oklch(55.4% .135 66.442);
    --color-yellow-950: oklch(28.6% .066 53.813);
    --color-lime-300: oklch(89.7% .196 126.665);
    --color-lime-400: oklch(84.1% .238 128.85);
    --color-lime-600: oklch(64.8% .2 131.684);
    --color-lime-700: oklch(53.2% .157 131.589);
    --color-lime-950: oklch(27.4% .072 132.109);
    --color-green-400: oklch(79.2% .209 151.711);
    --color-green-500: oklch(72.3% .219 149.579);
    --color-green-600: oklch(62.7% .194 149.214);
    --color-green-700: oklch(52.7% .154 150.069);
    --color-green-900: oklch(39.3% .095 152.535);
    --color-emerald-400: oklch(76.5% .177 163.223);
    --color-emerald-500: oklch(69.6% .17 162.48);
    --color-emerald-600: oklch(59.6% .145 163.225);
    --color-emerald-700: oklch(50.8% .118 165.612);
    --color-emerald-900: oklch(37.8% .077 168.94);
    --color-teal-300: oklch(85.5% .138 181.071);
    --color-teal-400: oklch(77.7% .152 181.912);
    --color-teal-500: oklch(70.4% .14 182.503);
    --color-teal-600: oklch(60% .118 184.704);
    --color-teal-700: oklch(51.1% .096 186.391);
    --color-teal-900: oklch(38.6% .063 188.416);
    --color-cyan-300: oklch(86.5% .127 207.078);
    --color-cyan-400: oklch(78.9% .154 211.53);
    --color-cyan-500: oklch(71.5% .143 215.221);
    --color-cyan-700: oklch(52% .105 223.128);
    --color-cyan-950: oklch(30.2% .056 229.695);
    --color-sky-300: oklch(82.8% .111 230.318);
    --color-sky-500: oklch(68.5% .169 237.323);
    --color-sky-600: oklch(58.8% .158 241.966);
    --color-sky-700: oklch(50% .134 242.749);
    --color-sky-900: oklch(39.1% .09 240.876);
    --color-blue-300: oklch(80.9% .105 251.813);
    --color-blue-400: oklch(70.7% .165 254.624);
    --color-blue-500: oklch(62.3% .214 259.815);
    --color-blue-600: oklch(54.6% .245 262.881);
    --color-blue-700: oklch(48.8% .243 264.376);
    --color-blue-900: oklch(37.9% .146 265.522);
    --color-indigo-200: oklch(87% .065 274.039);
    --color-indigo-300: oklch(78.5% .115 274.713);
    --color-indigo-400: oklch(67.3% .182 276.935);
    --color-indigo-500: oklch(58.5% .233 277.117);
    --color-indigo-600: oklch(51.1% .262 276.966);
    --color-indigo-700: oklch(45.7% .24 277.023);
    --color-indigo-900: oklch(35.9% .144 278.697);
    --color-violet-200: oklch(89.4% .057 293.283);
    --color-violet-300: oklch(81.1% .111 293.571);
    --color-violet-400: oklch(70.2% .183 293.541);
    --color-violet-500: oklch(60.6% .25 292.717);
    --color-violet-600: oklch(54.1% .281 293.009);
    --color-violet-700: oklch(49.1% .27 292.581);
    --color-violet-900: oklch(38% .189 293.745);
    --color-purple-200: oklch(90.2% .063 306.703);
    --color-purple-300: oklch(82.7% .119 306.383);
    --color-purple-400: oklch(71.4% .203 305.504);
    --color-purple-500: oklch(62.7% .265 303.9);
    --color-purple-600: oklch(55.8% .288 302.321);
    --color-purple-700: oklch(49.6% .265 301.924);
    --color-purple-900: oklch(38.1% .176 304.987);
    --color-fuchsia-200: oklch(90.3% .076 319.62);
    --color-fuchsia-300: oklch(83.3% .145 321.434);
    --color-fuchsia-400: oklch(74% .238 322.16);
    --color-fuchsia-500: oklch(66.7% .295 322.15);
    --color-fuchsia-600: oklch(59.1% .293 322.896);
    --color-fuchsia-700: oklch(51.8% .253 323.949);
    --color-fuchsia-900: oklch(40.1% .17 325.612);
    --color-pink-200: oklch(89.9% .061 343.231);
    --color-pink-300: oklch(82.3% .12 346.018);
    --color-pink-400: oklch(71.8% .202 349.761);
    --color-pink-500: oklch(65.6% .241 354.308);
    --color-pink-600: oklch(59.2% .249 .584);
    --color-pink-700: oklch(52.5% .223 3.958);
    --color-pink-900: oklch(40.8% .153 2.432);
    --color-rose-200: oklch(89.2% .058 10.001);
    --color-rose-300: oklch(81% .117 11.638);
    --color-rose-400: oklch(71.2% .194 13.428);
    --color-rose-500: oklch(64.5% .246 16.439);
    --color-rose-600: oklch(58.6% .253 17.585);
    --color-rose-700: oklch(51.4% .222 16.935);
    --color-rose-900: oklch(41% .159 10.272);
    --color-zinc-50: oklch(98.5% 0 0);
    --color-zinc-100: oklch(96.7% .001 286.375);
    --color-zinc-200: oklch(92% .004 286.32);
    --color-zinc-300: oklch(87.1% .006 286.286);
    --color-zinc-400: oklch(70.5% .015 286.067);
    --color-zinc-500: oklch(55.2% .016 285.938);
    --color-zinc-600: oklch(44.2% .017 285.786);
    --color-zinc-700: oklch(37% .013 285.805);
    --color-zinc-800: oklch(27.4% .006 286.033);
    --color-zinc-900: oklch(21% .006 285.885);
    --color-zinc-950: oklch(14.1% .005 285.823);
    --color-black: #000;
    --color-white: #fff;
}

body.dark-mode {
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --border-color: #4a5568;
}

/* Dark Mode Overrides */
body.dark-mode { background: var(--bg-primary) !important; }
body.dark-mode .stat-card, body.dark-mode .tab-section { background: var(--bg-secondary) !important; border-color: var(--border-color) !important; }
body.dark-mode .page-title { color: var(--text-primary) !important; }
body.dark-mode .page-subtitle, body.dark-mode .stat-label { color: var(--text-secondary) !important; }
body.dark-mode .stat-value, body.dark-mode .item-name { color: var(--text-primary) !important; }
body.dark-mode .item { background: rgba(255,255,255,0.05) !important; border-color: var(--border-color) !important; }
body.dark-mode .item:hover { background: rgba(255,255,255,0.1) !important; }
body.dark-mode .empty-state { color: var(--text-secondary) !important; }
body.dark-mode .form-input { background: rgba(255,255,255,0.05) !important; color: var(--text-primary) !important; border-color: var(--border-color) !important; }

/* Base Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    font-family: 'Amazon Ember', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; 
    background: var(--bg-primary); 
    transition: background 0.3s ease; 
}

/* Page Layout */
#page-content { padding: 24px; max-width: 1400px; margin: 0 auto; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-title { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* Buttons - AWS Design System */
.btn-primary { 
    background: #48bb78;
    color: white;
    padding: 12px 32px; 
    border: none;
    border-radius: 8px;
    cursor: pointer; 
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
    transition: all 0.2s ease;
    font-size: 14px;
    text-align: center;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
    background: #3da866;
}
.btn-success {
    background: #48bb78;
    color: white;
    padding: 12px 32px; 
    border: none;
    border-radius: 8px;
    cursor: pointer; 
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
    transition: all 0.2s ease;
    font-size: 14px;
}
.btn-success:hover { 
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
    transform: translateY(-1px);
    background: #3da866;
}
.btn-secondary {
    background: #232F3E;
    color: white;
    padding: 12px 32px; 
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 24px;
    cursor: pointer; 
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    font-size: 14px;
}
.btn-secondary:hover { 
    background: #37475A;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.btn-small { 
    padding: 6px 14px; 
    border: none; 
    border-radius: 20px;
    cursor: pointer; 
    font-size: 12px; 
    font-weight: 600; 
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.btn-small:hover { 
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}
.btn-build { 
    background: #48bb78;
    color: white;
}
.btn-edit { 
    background: #4299e1;
    color: white;
}
.btn-delete { 
    background: #dc3545;
    color: white;
}
.btn-auto { 
    background: #FF9900;
    color: white;
}
.btn-cancel { 
    padding: 12px 32px; 
    border: 1px solid rgba(255,255,255,0.3); 
    border-radius: 8px;
    background: transparent;
    cursor: pointer; 
    font-weight: 600; 
    transition: all 0.2s ease;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
}
.btn-cancel:hover { 
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
}

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { 
    background: var(--bg-secondary); 
    border: 1px solid var(--border-color);
    border-radius: 8px; 
    padding: 20px; 
    transition: all 0.3s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; }
.stat-value { font-size: 32px; font-weight: 700; color: #667eea; display: inline-block; margin-right: 8px; }
.stat-meta { font-size: 12px; color: var(--text-secondary); margin-top: 8px; }
.stat-change { font-size: 13px; font-weight: 600; margin-left: 8px; }
.stat-change.positive { color: #48bb78; }
.stat-change.negative { color: #dc3545; }

/* Theme Toggle */
.theme-toggle { 
    position: fixed; 
    top: 20px; 
    right: 20px; 
    background: var(--bg-secondary); 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    padding: 8px 16px;
    display: flex; 
    align-items: center; 
    gap: 8px;
    cursor: pointer; 
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}
.theme-toggle:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.theme-options { 
    position: fixed; 
    top: 75px; 
    right: 20px; 
    background: var(--bg-secondary); 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    min-width: 150px;
}
.theme-options.active { display: flex; }
.theme-option {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.theme-option:hover { background: rgba(102, 126, 234, 0.1); }
.theme-option.selected { background: rgba(102, 126, 234, 0.15); color: #667eea; font-weight: 600; }

/* Tabs */
.tabs-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tab-section { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; transition: all 0.3s ease; }
.tab-header { 
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%); 
    color: #667eea; 
    padding: 16px 20px; 
    font-weight: 700; 
    font-size: 16px; 
    border: 1px solid rgba(102, 126, 234, 0.2);
    backdrop-filter: blur(10px);
}
.tab-content { padding: 20px; min-height: 400px; }

/* Items */
.item-list { display: flex; flex-direction: column; gap: 8px; }
.item { 
    display: flex; 
    flex-direction: column;
    padding: 12px; 
    background: #f8f9fa; 
    border-radius: 12px; 
    border: 1px solid var(--border-color); 
    cursor: pointer; 
    transition: all 0.2s ease;
}
.item:hover { background: #f0f1f3; border-color: #667eea; }
.item.selected { background: #e6f0ff; border-color: #667eea; }
.item-header { display: flex; justify-content: space-between; align-items: center; }
.item-name { font-weight: 600; color: var(--text-primary); }
.item-meta { font-size: 11px; color: var(--text-secondary); margin-top: 6px; line-height: 1.4; }
.item-desc { font-size: 12px; color: var(--text-secondary); margin-top: 6px; line-height: 1.4; }
.item-badge { 
    background: rgba(102, 126, 234, 0.15); 
    color: #667eea; 
    padding: 4px 12px; 
    border-radius: 20px; 
    font-size: 12px; 
    font-weight: 600; 
    margin-right: 8px; 
}
.item-actions { display: flex; gap: 6px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }

/* Modal */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0, 0, 0, 0.5); 
    z-index: 9999; 
    align-items: center; 
    justify-content: center;
    backdrop-filter: blur(10px);
}
.modal.active { display: flex !important; }
.modal-content { 
    background: #3e4d5e !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-radius: 16px; 
    width: 90%; 
    max-width: 600px; 
    max-height: 90vh; 
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
}
@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-header { 
    padding: 24px; 
    border-bottom: 1px solid rgba(255,255,255,0.1); 
    text-align: center;
}
.modal-title { font-size: 20px; font-weight: 700; color: #ffffff; }
.modal-close { 
    position: absolute;
    top: 16px;
    right: 16px;
    background: none; 
    border: none; 
    font-size: 24px; 
    cursor: pointer; 
    color: rgba(255,255,255,0.6);
    transition: color 0.2s ease;
}
.modal-close:hover { color: rgba(255,255,255,1); }
.modal-body { padding: 24px; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.form-label { 
    display: block; 
    font-size: 12px; 
    font-weight: 600; 
    color: #ffffff;
    margin-bottom: 8px; 
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-input { 
    width: 100%; 
    padding: 12px 16px; 
    border: 1px solid #4a5568;
    border-radius: 8px; 
    font-size: 14px;
    background: rgba(0,0,0,0.3) !important;
    color: #ffffff !important;
    transition: all 0.2s ease;
    font-family: 'Amazon Ember', sans-serif;
}
.form-input::placeholder {
    color: rgba(255,255,255,0.5) !important;
}
.form-input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(0,0,0,0.35) !important;
}
textarea.form-input {
    border-color: #4a5568;
}
.form-actions { 
    display: flex;
    justify-content: center;
    gap: 12px; 
    margin-top: 24px; 
}
.form-actions button {
    min-width: 140px;
}
/* Batch Operations Styles */
.search-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.search-row {
    display: flex;
    gap: 15px;
    align-items: end;
    margin-bottom: 15px;
}

.operation-item {
    margin-bottom: 10px;
    border-radius: 0 4px 4px 0;
    transition: all 0.2s ease;
}

.operation-item.active {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.operation-details {
    margin-top: 15px;
    padding-top: 15px;
    display: none;
}

.operation-item.active .operation-details {
    display: block;
}

.operation-toggle {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.operation-toggle:hover {
    transform: scale(1.1);
}

.table-container table th {
    background: #f8f9fa;
    font-weight: 600;
    padding: 12px 8px;
    border-bottom: 2px solid #dee2e6;
}

.table-container table td {
    padding: 12px 8px;
    border-bottom: 1px solid #dee2e6;
}

.table-container table tbody tr:hover {
    background: #f8f9fa;
}

/* Form elements */
input[type="text"], select, textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

input[type="text"]:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Button styles */
button {
    cursor: pointer;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

/* Status badges */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-rejected {
    background: #f8d7da;
    color: #721c24;
}

.status-awaiting-3rd-party {
    background: #ffeaa7;
    color: #d63031;
}