@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --sidebar-width: 250px;
    --header-height: 60px;
}

html, body {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #f5f5f5;
    height: 100%;
    margin: 0;
    padding: 0;
}

.page {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--dark-color);
    color: white;
    padding: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-row {
    background-color: white;
    border-bottom: 1px solid #dee2e6;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background-color: #f8f9fa;
}

/* Card Styles */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: white;
    border-bottom: 1px solid #dee2e6;
    border-radius: 10px 10px 0 0 !important;
    font-weight: 600;
    color: var(--dark-color);
}

/* Button Enhancements */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    border: none;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border: none;
}

/* Table Styles */
.table {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.table th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: var(--dark-color);
}

.table td {
    vertical-align: middle;
    border-bottom: 1px solid #f1f3f4;
}

/* Status Badges */
.badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 50px;
    font-weight: 500;
}

/* Sidebar Navigation */
.sidebar-nav {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.sidebar-nav .navbar-brand {
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.sidebar-nav .navbar-brand:hover {
    color: white;
    background-color: rgba(255,255,255,0.05);
}

.sidebar-nav .nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-divider {
    height: 1px;
    background-color: rgba(255,255,255,0.1);
    margin: 1rem 1rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.version-info {
    color: rgba(255,255,255,0.6);
    font-size: 0.75rem;
}

/* Navigation Styles */
.nav-link {
    color: rgba(255,255,255,0.8);
    padding: 1rem 1.5rem;
    border-radius: 0;
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    color: white;
    background-color: rgba(255,255,255,0.1);
}

.nav-link i {
    margin-right: 0.5rem;
}

/* Sidebar Menu Styles */
.sidebar .navbar-brand {
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* Form Styles */
.form-control {
    border-radius: 6px;
    border: 1px solid #ced4da;
    padding: 0.75rem 1rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

/* Alert Styles */
.alert {
    border: none;
    border-radius: 8px;
    padding: 1rem 1.5rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* Loading Spinner */
.spinner-border {
    width: 1rem;
    height: 1rem;
}

/* Dashboard Stats Cards */
.stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transform: translate(30px, -30px);
}

.stats-card h3 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.stats-card p {
    margin: 0;
    opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main {
        margin-left: 0;
    }
    
    .content {
        padding: 1rem;
    }
}

/* Wizard Steps */
.wizard-step {
    background-color: white;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.wizard-step h4 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

/* Progress Bar */
.progress {
    height: 8px;
    border-radius: 4px;
    background-color: #e9ecef;
}

.progress-bar {
    background: linear-gradient(90deg, #007bff 0%, #0056b3 100%);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

a, .btn-link {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover, .btn-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

.token-expiry-badge {
    font-weight: 600;
}

.targeting-builder {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.targeting-panel {
    background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
    border: 1px solid #dbe4f0;
    border-radius: 16px;
    padding: 1.5rem;
}

.targeting-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.targeting-panel-header h5 {
    margin: 0 0 0.35rem 0;
    color: #16324f;
}

.targeting-panel-header p {
    margin: 0;
    color: #5f7287;
}

.targeting-age-chip {
    background: #16324f;
    color: #fff;
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-weight: 700;
    white-space: nowrap;
}

.targeting-age-range {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.targeting-range-scale {
    display: flex;
    justify-content: space-between;
    color: #64748b;
    font-size: 0.9rem;
}

.targeting-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.targeting-mode-note {
    color: #5f7287;
    font-size: 0.95rem;
}

.targeting-search-box {
    position: relative;
    margin-bottom: 1rem;
}

.targeting-search-results {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    right: 0;
    z-index: 10;
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
}

.targeting-search-helper {
    margin-top: 0.45rem;
    font-size: 0.9rem;
    color: #64748b;
}

.targeting-search-helper-error {
    color: #b42318;
}

.targeting-search-result {
    width: 100%;
    border: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    padding: 0.9rem 1rem;
    text-align: left;
}

.targeting-search-result + .targeting-search-result {
    border-top: 1px solid #eef2f7;
}

.targeting-search-result:hover {
    background: #eef6ff;
}

.targeting-search-result-title {
    font-weight: 600;
    color: #17324d;
}

.targeting-search-result-subtitle {
    color: #5f7287;
    font-size: 0.9rem;
}

.targeting-location-card {
    height: 100%;
    border: 1px solid #d7e4dd;
    border-radius: 16px;
    background: #f9fffb;
    padding: 1rem;
}

.targeting-location-card-excluded {
    border-color: #ecd7dc;
    background: #fff9fa;
}

.targeting-location-card-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.targeting-location-card-header h6 {
    margin: 0 0 0.25rem 0;
}

.targeting-location-card-header p {
    margin: 0;
    color: #64748b;
    font-size: 0.92rem;
}

.targeting-location-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.targeting-location-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #e6edf5;
}

.targeting-location-copy {
    min-width: 0;
}

.targeting-location-title {
    font-weight: 700;
    color: #17324d;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.targeting-location-type {
    font-size: 0.78rem;
    font-weight: 600;
    color: #0f766e;
    background: #dff7f4;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.targeting-location-meta {
    color: #64748b;
    font-size: 0.92rem;
    margin-top: 0.25rem;
}

.targeting-location-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.targeting-radius-editor {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 88px;
}

.targeting-radius-editor label {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0;
}

.targeting-empty-state {
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    padding: 1rem;
    color: #64748b;
    background: rgba(255,255,255,0.6);
}

.targeting-json-preview {
    margin-top: 1.25rem;
}

.conversion-location-panel {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.conversion-location-option {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    text-align: left;
    padding: 1rem 1.05rem;
    border-radius: 16px;
    border: 1px solid #d6dce5;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.conversion-location-option.selected {
    border-color: #1d4ed8;
    background: #f8fbff;
}

.conversion-location-option.disabled {
    border-style: dashed;
    background: #f8fafc;
    opacity: 0.72;
}

.conversion-location-option.disabled .conversion-location-indicator {
    border-color: #94a3b8;
    background: transparent;
}

.conversion-location-option-static {
    cursor: default;
}

.conversion-location-indicator {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid #1d4ed8;
    margin-top: 0.15rem;
    background: radial-gradient(circle, #2563eb 0 45%, transparent 48%);
    flex: 0 0 auto;
}

.conversion-location-copy {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.conversion-location-copy strong {
    color: #17324d;
    font-size: 1rem;
}

.conversion-location-copy small {
    color: #64748b;
    font-size: 0.92rem;
    line-height: 1.4;
}

.form-select {
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid #d6dce5;
    background-color: #fff;
    padding: 0.65rem 2.5rem 0.65rem 0.9rem;
    font-size: 0.98rem;
    line-height: 1.3;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.12);
}

@media (max-width: 768px) {
    .targeting-age-range {
        grid-template-columns: 1fr;
    }

    .targeting-panel-header,
    .targeting-location-item {
        flex-direction: column;
    }

    .targeting-location-actions {
        justify-content: flex-start;
    }
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }
