/* Custom properties (tokens) */
:root {
    --bg-primary: #0a111a;
    --bg-secondary: #132238;
    --bg-tertiary: #1D3557; /* Brand Navy base */
    --accent-red: #E63946;
    --accent-yellow: #FFB703;
    --text-primary: #FAF9F5;
    --text-secondary: #90a0b8;
    --border-color: rgba(255, 183, 3, 0.15);
    --border-glow: rgba(230, 57, 70, 0.3);
    --radius-lg: 12px;
    --radius-pill: 100px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    
    /* Status Colors */
    --status-pending: #FFB703;
    --status-contacted: #00B4D8;
    --status-negotiating: #9D4EDD;
    --status-completed: #2ECC71;
}

/* Global resets and layouts */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Outfit', 'Noto Sans KR', sans-serif;
    letter-spacing: -0.03em;
    min-height: 100vh;
}

/* Login Page Specific Styles */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.login-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 20px;
}

.login-container {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    box-shadow: 0 20px 50px -10px rgba(230, 57, 70, 0.1), 0 0 1px rgba(230, 57, 70, 0.2);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-red), var(--accent-yellow));
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    font-size: 26px;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    text-shadow: 0 0 10px rgba(230, 57, 70, 0.5);
}

.login-subtitle {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-yellow);
    letter-spacing: 0.2em;
    margin-top: 5px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.label-icon {
    font-size: 16px;
    margin-right: 5px;
}

.form-group input,
.filter-group select,
.filter-group input {
    width: 100%;
    padding: 12px 16px;
    background-color: rgba(10, 17, 26, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 8px rgba(230, 57, 70, 0.4);
    background-color: rgba(10, 17, 26, 0.9);
}

.login-alert {
    display: flex;
    align-items: center;
    background-color: rgba(230, 57, 70, 0.15);
    border: 1px solid var(--accent-red);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    margin-bottom: 20px;
    color: var(--accent-red);
    font-size: 13px;
}

.alert-icon {
    margin-right: 8px;
    font-size: 18px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    gap: 8px;
}

.btn-primary {
    background-color: var(--accent-red);
    color: var(--text-primary);
    box-shadow: 0 8px 20px -5px rgba(230, 57, 70, 0.4);
    width: 100%;
}

.btn-primary:hover {
    background-color: #f84b58;
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -5px rgba(230, 57, 70, 0.6);
}

.btn-pill {
    border-radius: var(--radius-pill);
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    font-size: 11px;
    color: var(--text-secondary);
}


/* Admin Dashboard Shell Layout */
.admin-body {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.admin-sidebar {
    width: 260px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 35px;
}

.brand-neon {
    font-size: 20px;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    text-shadow: 0 0 10px rgba(230, 57, 70, 0.5);
}

.brand-badge {
    font-size: 9px;
    font-weight: 900;
    color: var(--accent-yellow);
    background-color: rgba(255, 183, 3, 0.15);
    border: 1px solid var(--accent-yellow);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    margin-top: 6px;
    letter-spacing: 0.1em;
}

.admin-user-profile {
    display: flex;
    align-items: center;
    background-color: rgba(10, 17, 26, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 12px;
    margin-bottom: 30px;
}

.avatar-icon {
    font-size: 38px;
    color: var(--accent-yellow);
    margin-right: 10px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.user-role {
    font-size: 11px;
    color: var(--text-secondary);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-lg);
    transition: var(--transition);
    gap: 12px;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    box-shadow: inset 4px 0 0 var(--accent-red);
}

.nav-icon {
    font-size: 20px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
}

.btn-outline-danger {
    background-color: transparent;
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.btn-outline-danger:hover {
    background-color: var(--accent-red);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.3);
}

/* Main Panel Layout */
.admin-main {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.header-title h1 {
    font-size: 28px;
    font-weight: 900;
    color: var(--text-primary);
}

.header-title p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.last-sync {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: var(--radius-pill);
}

.last-sync .material-icons {
    font-size: 14px;
    animation: spin 3s linear infinite;
}

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

/* Stats Widgets Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 35px;
}

.stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.all { background-color: rgba(255, 255, 255, 0.05); color: var(--text-primary); }
.stat-icon.pending { background-color: rgba(255, 183, 3, 0.15); color: var(--status-pending); }
.stat-icon.contacted { background-color: rgba(0, 180, 216, 0.15); color: var(--status-contacted); }
.stat-icon.negotiating { background-color: rgba(157, 78, 221, 0.15); color: var(--status-negotiating); }
.stat-icon.completed { background-color: rgba(46, 204, 113, 0.15); color: var(--status-completed); }

.stat-icon .material-icons {
    font-size: 24px;
}

.stat-value {
    font-size: 24px;
    font-weight: 900;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Card Styling */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 25px;
    margin-bottom: 30px;
}

/* Filters Card */
.filters-form {
    display: grid;
    grid-template-columns: repeat(3, 1fr) auto;
    align-items: flex-end;
    gap: 20px;
}

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

.filter-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.search-input-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 18px;
}

.search-input-wrapper input {
    padding-left: 38px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
}

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

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
}

/* Table Card Styling */
.table-card {
    padding: 30px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.table-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.table-count {
    color: var(--accent-yellow);
    font-size: 14px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.inquiries-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.inquiries-table th, 
.inquiries-table td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 183, 3, 0.08);
    font-size: 14px;
}

.inquiries-table th {
    font-weight: 700;
    color: var(--text-secondary);
    background-color: rgba(10, 17, 26, 0.3);
    border-bottom: 2px solid var(--border-color);
}

.inquiry-row:hover {
    background-color: rgba(29, 53, 87, 0.15);
}

.date-text {
    font-family: 'Outfit', sans-serif;
    color: var(--text-secondary);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.badge-type.franchise {
    background-color: rgba(230, 57, 70, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(230, 57, 70, 0.3);
}

.badge-type.general {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.guest-name {
    font-weight: 700;
}

.contact-details, .area-budget {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.phone-link, .email-link {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-secondary);
}

.inline-icon {
    font-size: 14px;
    color: var(--accent-yellow);
}

.area-text {
    font-weight: 500;
}

.budget-text {
    font-size: 12px;
    color: var(--accent-yellow);
    font-weight: 700;
}

/* UTM styling */
.utm-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 200px;
}

.utm-badge {
    font-size: 10px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Outfit', sans-serif;
}

.utm-source { background-color: rgba(0, 180, 216, 0.15); color: #00B4D8; }
.utm-medium { background-color: rgba(157, 78, 221, 0.15); color: #9D4EDD; }
.utm-campaign { background-color: rgba(255, 183, 3, 0.15); color: #FFB703; }
.utm-none {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.25);
    font-style: italic;
}

/* Status select custom dropdown styling */
.status-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.status-select {
    padding: 8px 30px 8px 12px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 130px;
    appearance: none;
    -webkit-appearance: none;
}

.status-select:focus {
    outline: none;
    border-color: var(--accent-yellow);
}

.status-select.loading {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Success flash outline after ajax call completed */
.success-flash {
    animation: pulse-green 1s;
}

@keyframes pulse-green {
    0% { border-color: var(--status-completed); box-shadow: 0 0 10px rgba(46, 204, 113, 0.6); }
    100% { border-color: var(--border-color); box-shadow: none; }
}

.status-select-wrapper::after {
    content: "arrow_drop_down";
    font-family: "Material Icons";
    position: absolute;
    right: 10px;
    color: var(--text-secondary);
    pointer-events: none;
    font-size: 18px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: absolute;
    left: -14px;
}

.status-indicator.pending { background-color: var(--status-pending); box-shadow: 0 0 6px var(--status-pending); }
.status-indicator.contacted { background-color: var(--status-contacted); box-shadow: 0 0 6px var(--status-contacted); }
.status-indicator.negotiating { background-color: var(--status-negotiating); box-shadow: 0 0 6px var(--status-negotiating); }
.status-indicator.completed { background-color: var(--status-completed); box-shadow: 0 0 6px var(--status-completed); }

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 50px 0 !important;
}

.no-data .material-icons {
    font-size: 40px;
    margin-bottom: 10px;
}

/* Expandable Drawer Row Styling */
.detail-drawer-row {
    background-color: rgba(10, 17, 26, 0.4);
}

.detail-drawer-row.hidden {
    display: none;
}

.detail-content {
    padding: 25px;
    border-left: 3px solid var(--accent-red);
    animation: slideDown 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes slideDown {
    0% { opacity: 0; transform: translateY(-10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.detail-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 30px;
}

.detail-section h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.section-icon {
    font-size: 16px;
    color: var(--accent-yellow);
}

.inquiry-text-box {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 13.5px;
    min-height: 200px;
    white-space: pre-wrap;
}

.metadata-table {
    width: 100%;
    border-collapse: collapse;
}

.metadata-table th, 
.metadata-table td {
    padding: 10px 12px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03) !important;
    font-size: 13px !important;
}

.metadata-table th {
    font-weight: 700;
    color: var(--text-secondary);
    width: 100px;
    background-color: transparent !important;
    border-right: 1px solid rgba(255, 255, 255, 0.03);
}

.metadata-table td {
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-toggle-details.active {
    background-color: var(--accent-red);
    color: var(--text-primary);
    border-color: var(--accent-red);
}

/* Toast popup notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--status-completed);
    border-radius: var(--radius-lg);
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    transform: translateY(100px);
    opacity: 0;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.hidden {
    display: none;
}

.toast-icon {
    color: var(--status-completed);
    font-size: 20px;
}

.toast-message {
    font-size: 13.5px;
    font-weight: 700;
}

/* Responsive breakdowns */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .admin-body {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 20px;
    }
    
    .sidebar-brand {
        margin-bottom: 15px;
    }
    
    .admin-user-profile, .sidebar-footer {
        display: none;
    }
    
    .sidebar-nav {
        flex-direction: row;
        justify-content: center;
    }
    
    .admin-main {
        padding: 20px;
    }
    
    .filters-form {
        grid-template-columns: 1fr;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Custom Select Dropdown Styling */
select.form-control,
.filter-group select,
.select-status {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23E63946' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px !important; /* Make room for the custom arrow */
}

select.form-control:focus,
.filter-group select:focus,
.select-status:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 8px rgba(230, 57, 70, 0.4);
    background-color: rgba(10, 17, 26, 0.9);
}

