/* ============================================
   Policy Modal Styles
   ============================================ */

/* Policy Modal Base */
.policy-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    animation: policyFadeIn 0.3s ease-in-out;
}

.policy-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes policyFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes policySlideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.policy-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.policy-modal-container {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: policySlideUp 0.3s ease-out;
}

html.dark-theme .policy-modal-container {
    background: #1e293b;
}

/* Modal Header */
.policy-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    background: linear-gradient(135deg, #4c1d95 0%, #5b21b6 100%);
    color: white;
}

html.dark-theme .policy-modal-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
}

.policy-modal-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.policy-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.policy-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Modal Body */
.policy-modal-body {
    padding: 30px;
    max-height: calc(85vh - 180px);
    overflow-y: auto;
}

/* Quick Status Section */
.policy-quick-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.policy-status-card {
    background: #f9fafb;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 2px solid #e5e7eb;
    transition: all 0.3s;
}

html.dark-theme .policy-status-card {
    background: #334155;
    border-color: #475569;
}

.policy-status-card:hover {
    border-color: #8b5cf6;
    transform: translateY(-2px);
}

html.dark-theme .policy-status-card:hover {
    border-color: #7c3aed;
}

.policy-status-icon {
    font-size: 32px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ddd6fe;
    border-radius: 12px;
}

html.dark-theme .policy-status-icon {
    background: #312e81;
    color: #c4b5fd;
}

.policy-status-icon.active {
    background: #10b981;
    color: white;
}

.policy-status-info {
    flex: 1;
}

.policy-status-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
}

html.dark-theme .policy-status-label {
    color: #94a3b8;
}

.policy-status-value {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

html.dark-theme .policy-status-value {
    color: #f1f5f9;
}

/* Toggle Switch */
.policy-toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
    background: #cbd5e1;
    border-radius: 15px;
    cursor: pointer;
    transition: background 0.3s;
}

.policy-toggle-switch.active {
    background: #10b981;
}

.policy-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.policy-toggle-switch.active .policy-toggle-slider {
    transform: translateX(30px);
}

/* Tabs */
.policy-modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e5e7eb;
}

html.dark-theme .policy-modal-tabs {
    border-bottom-color: #475569;
}

.policy-modal-tab {
    padding: 12px 24px;
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
}

html.dark-theme .policy-modal-tab {
    color: #94a3b8;
}

.policy-modal-tab.active {
    color: #8b5cf6;
}

html.dark-theme .policy-modal-tab.active {
    color: #a78bfa;
}

.policy-modal-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #8b5cf6;
}

html.dark-theme .policy-modal-tab.active::after {
    background: #a78bfa;
}

.policy-tab-content {
    display: none;
}

.policy-tab-content.active {
    display: block;
    animation: policyFadeIn 0.3s;
}

/* Coin Selector */
.policy-coin-selector {
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #4c1d95 0%, #5b21b6 100%);
    border-radius: 12px;
}

html.dark-theme .policy-coin-selector {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
}

.policy-coin-selector label {
    display: block;
    color: white;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.policy-coin-selector select {
    padding: 12px 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    background: white;
    color: #1f2937;
    cursor: pointer;
}

html.dark-theme .policy-coin-selector select {
    background: #1e293b;
    color: #f1f5f9;
    border-color: rgba(255, 255, 255, 0.2);
}

.policy-coin-selector select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
}

/* Current Coin Info - Legacy (can be removed) */
.policy-current-coin {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.policy-coin-icon {
    font-size: 48px;
}

.policy-coin-name {
    font-size: 24px;
    font-weight: 700;
}

/* Quick Settings Grid - 2 Column Layout */
.policy-quick-settings {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .policy-quick-settings {
        grid-template-columns: 1fr;
    }
}

.policy-quick-setting {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.policy-quick-setting label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

html.dark-theme .policy-quick-setting label {
    color: #cbd5e0;
}

.policy-quick-setting input,
.policy-quick-setting select {
    padding: 10px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
    background: white;
    color: #1f2937;
}

html.dark-theme .policy-quick-setting input,
html.dark-theme .policy-quick-setting select {
    background: #1e293b;
    border-color: #475569;
    color: #f1f5f9;
}

.policy-quick-setting input:focus,
.policy-quick-setting select:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

html.dark-theme .policy-quick-setting input:focus,
html.dark-theme .policy-quick-setting select:focus {
    border-color: #a78bfa;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.1);
}

/* Presets - Improved */
.policy-preset-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
}

html.dark-theme .policy-preset-section {
    background: #0f172a;
    border-color: #1e293b;
}

.policy-preset-section h4 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1f2937;
}

html.dark-theme .policy-preset-section h4 {
    color: #f1f5f9;
}

.policy-preset-hint {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 15px;
}

html.dark-theme .policy-preset-hint {
    color: #94a3b8;
}

/* Style Selector Toggle */
.preset-style-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.preset-style-btn {
    flex: 1;
    padding: 12px 20px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: #6b7280;
}

html.dark-theme .preset-style-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

.preset-style-btn:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
}

html.dark-theme .preset-style-btn:hover {
    border-color: #a78bfa;
    color: #a78bfa;
}

.preset-style-btn.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border-color: #8b5cf6;
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

html.dark-theme .preset-style-btn.active {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    border-color: #7c3aed;
}

.policy-preset-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.policy-preset-btn {
    padding: 16px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

html.dark-theme .policy-preset-btn {
    background: #1e293b;
    border-color: #334155;
}

.policy-preset-btn:hover {
    border-color: #8b5cf6;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.25);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(139, 92, 246, 0.1) 100%);
}

html.dark-theme .policy-preset-btn:hover {
    border-color: #a78bfa;
    box-shadow: 0 8px 20px rgba(167, 139, 250, 0.15);
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.05) 0%, rgba(167, 139, 250, 0.1) 100%);
}

.preset-icon {
    font-size: 32px;
    line-height: 1;
}

.preset-name {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
}

html.dark-theme .preset-name {
    color: #f1f5f9;
}

.preset-desc {
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
}

html.dark-theme .preset-desc {
    color: #94a3b8;
}

.preset-time {
    font-size: 10px;
    color: #8b5cf6;
    font-weight: 600;
    margin-top: 4px;
}

html.dark-theme .preset-time {
    color: #a78bfa;
}

/* Settings Divider */
.policy-settings-divider {
    position: relative;
    text-align: center;
    margin: 25px 0;
}

.policy-settings-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e5e7eb 20%, #e5e7eb 80%, transparent);
}

html.dark-theme .policy-settings-divider::before {
    background: linear-gradient(90deg, transparent, #475569 20%, #475569 80%, transparent);
}

.policy-settings-divider span {
    position: relative;
    background: white;
    padding: 0 15px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 1px;
}

html.dark-theme .policy-settings-divider span {
    background: #1e293b;
    color: #94a3b8;
}

/* Advanced Tab */
.policy-advanced-section,
.policy-global-section {
    margin-bottom: 30px;
}

.policy-advanced-section h3,
.policy-global-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #1f2937;
}

html.dark-theme .policy-advanced-section h3,
html.dark-theme .policy-global-section h3 {
    color: #f1f5f9;
}

.policy-loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

html.dark-theme .policy-loading {
    color: #94a3b8;
}

/* Policy Table */
.policy-table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
}

html.dark-theme .policy-table-wrapper {
    border-color: #475569;
}

.policy-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

html.dark-theme .policy-table {
    background: #1e293b;
}

.policy-table th {
    background: #f9fafb;
    padding: 12px 15px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e5e7eb;
}

html.dark-theme .policy-table th {
    background: #334155;
    color: #cbd5e0;
    border-bottom-color: #475569;
}

.policy-table td {
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
    color: #1f2937;
    font-size: 14px;
}

html.dark-theme .policy-table td {
    border-bottom-color: #475569;
    color: #f1f5f9;
}

.policy-table tbody tr:hover {
    background: #f9fafb;
}

html.dark-theme .policy-table tbody tr:hover {
    background: #334155;
}

.policy-table .coin-name {
    font-weight: 600;
    color: #8b5cf6;
}

html.dark-theme .policy-table .coin-name {
    color: #a78bfa;
}

.policy-table .status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.policy-table .status-active {
    background: #d1fae5;
    color: #065f46;
}

.policy-table .status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

html.dark-theme .policy-table .status-active {
    background: #065f46;
    color: #d1fae5;
}

html.dark-theme .policy-table .status-inactive {
    background: #991b1b;
    color: #fee2e2;
}

.policy-table .action-btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.policy-table .action-edit {
    background: #e9d5ff;
    color: #6b21a8;
}

.policy-table .action-edit:hover {
    background: #8b5cf6;
    color: white;
}

html.dark-theme .policy-table .action-edit {
    background: #4c1d95;
    color: #e9d5ff;
}

html.dark-theme .policy-table .action-edit:hover {
    background: #7c3aed;
    color: white;
}

.policy-table .action-delete {
    background: #fee2e2;
    color: #991b1b;
    margin-left: 5px;
}

.policy-table .action-delete:hover {
    background: #dc2626;
    color: white;
}

html.dark-theme .policy-table .action-delete {
    background: #7f1d1d;
    color: #fecaca;
}

html.dark-theme .policy-table .action-delete:hover {
    background: #991b1b;
    color: white;
}

.policy-global-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.policy-setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.policy-setting-item label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

html.dark-theme .policy-setting-item label {
    color: #cbd5e0;
}

.policy-setting-item input,
.policy-setting-item select {
    padding: 10px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    color: #1f2937;
}

html.dark-theme .policy-setting-item input,
html.dark-theme .policy-setting-item select {
    background: #1e293b;
    border-color: #475569;
    color: #f1f5f9;
}

/* Logs Tab */
.policy-logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.policy-logs-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

html.dark-theme .policy-logs-header h3 {
    color: #f1f5f9;
}

.policy-logs-container {
    max-height: 400px;
    overflow-y: auto;
    background: #1f2937;
    border-radius: 12px;
    padding: 20px;
}

html.dark-theme .policy-logs-container {
    background: #0f172a;
}

.policy-log-entry {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13px;
    color: #e5e7eb;
    padding: 8px;
    border-left: 3px solid transparent;
    margin-bottom: 5px;
}

/* Modal Footer */
.policy-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-top: 2px solid #e5e7eb;
    background: #f9fafb;
}

html.dark-theme .policy-modal-footer {
    border-top-color: #475569;
    background: #1e293b;
}

.policy-footer-left,
.policy-footer-right {
    display: flex;
    gap: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .policy-modal-container {
        width: 95%;
        max-height: 95vh;
    }

    .policy-quick-status {
        grid-template-columns: 1fr;
    }

    .policy-preset-buttons {
        grid-template-columns: 1fr;
    }

    .policy-modal-header {
        padding: 20px;
    }

    .policy-modal-header h2 {
        font-size: 20px;
    }

    .policy-modal-body {
        padding: 20px;
    }
}
