/* Squid Proxy Manager - GitHub Dark Theme Style */

:root {
    /* GitHub Dark Colors */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    --border-color: #30363d;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-blue: #58a6ff;
    --accent-green: #3fb950;
    --accent-red: #f85149;
    --accent-yellow: #d29922;
    --accent-purple: #a371f7;
    --accent-orange: #db6d28;
    --accent-cyan: #39c5cf;
    --shadow: 0 8px 24px rgba(1, 4, 9, 0.6);
    --radius: 6px;
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    padding: 20px;
}

.login-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

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

.login-header i {
    font-size: 48px;
    color: var(--accent-blue);
    margin-bottom: 15px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group label i {
    margin-right: 8px;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}

.btn-primary:hover:not(:disabled) {
    background: #4c9aed;
}

.btn-success {
    background: var(--accent-green);
    color: #fff;
    border-color: var(--accent-green);
}

.btn-success:hover:not(:disabled) {
    background: #37a55c;
}

.btn-danger {
    background: var(--accent-red);
    color: #fff;
    border-color: var(--accent-red);
}

.btn-danger:hover:not(:disabled) {
    background: #e64a41;
}

.btn-warning {
    background: var(--accent-yellow);
    color: #fff;
    border-color: var(--accent-yellow);
}

.btn-warning:hover:not(:disabled) {
    background: #c48f1e;
}

.btn-info {
    background: var(--accent-cyan);
    color: #fff;
    border-color: var(--accent-cyan);
}

.btn-info:hover:not(:disabled) {
    background: #32b5be;
}

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

.btn-outline:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--text-secondary);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-primary);
}

.btn-icon:hover {
    background: var(--bg-hover);
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header i {
    font-size: 24px;
    color: var(--accent-blue);
}

.sidebar-header span {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 15px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

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

.nav-item.active {
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.user-info i {
    font-size: 24px;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 25px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-left h2 {
    font-size: 18px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.service-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(63, 185, 80, 0.1);
    border-radius: 20px;
    font-size: 13px;
    color: var(--accent-green);
}

.service-status.stopped {
    background: rgba(248, 81, 73, 0.1);
    color: var(--accent-red);
}

.service-status i {
    font-size: 8px;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 25px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

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

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.bg-green {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-green);
}

.stat-icon.bg-blue {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-blue);
}

.stat-icon.bg-purple {
    background: rgba(163, 113, 247, 0.15);
    color: var(--accent-purple);
}

.stat-icon.bg-orange {
    background: rgba(219, 109, 40, 0.15);
    color: var(--accent-orange);
}

.stat-info h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 2px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 i {
    color: var(--accent-blue);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 20px;
}

/* Info List */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
}

.info-value {
    font-weight: 500;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* Config Section */
.config-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.config-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.config-section h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--accent-blue);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
}

.table tr:hover {
    background: var(--bg-hover);
}

.table td {
    font-size: 14px;
}

/* Service Status Card */
.service-status-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 30px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 25px;
}

.status-indicator {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(63, 185, 80, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-indicator i {
    font-size: 24px;
    color: var(--accent-green);
}

.status-indicator.stopped {
    background: rgba(248, 81, 73, 0.15);
}

.status-indicator.stopped i {
    color: var(--accent-red);
}

.status-info h3 {
    font-size: 24px;
    margin-bottom: 5px;
}

.status-info p {
    color: var(--text-secondary);
}

/* Service Actions */
.service-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.action-group h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

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

/* Config Validation */
.config-validation {
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.config-validation h4 {
    margin-bottom: 15px;
}

.validation-result {
    margin-top: 15px;
    padding: 15px;
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 13px;
}

.validation-result.success {
    background: rgba(63, 185, 80, 0.1);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
}

.validation-result.error {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

/* Log Container */
.log-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Consolas', 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
    line-height: 1.6;
}

.log-line {
    padding: 3px 0;
    border-bottom: 1px solid var(--border-color);
}

.log-line:last-child {
    border-bottom: none;
}

.log-time {
    color: var(--text-muted);
}

.log-client {
    color: var(--accent-cyan);
}

.log-method {
    color: var(--accent-purple);
}

.log-url {
    color: var(--text-primary);
    word-break: break-all;
}

.log-status {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.log-status.success {
    background: rgba(63, 185, 80, 0.2);
    color: var(--accent-green);
}

.log-status.error {
    background: rgba(248, 81, 73, 0.2);
    color: var(--accent-red);
}

.log-status.redirect {
    background: rgba(210, 153, 34, 0.2);
    color: var(--accent-yellow);
}

/* Code Editor */
.code-editor {
    width: 100%;
    min-height: 500px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 15px;
    font-family: 'SF Mono', 'Consolas', 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    resize: vertical;
}

.code-editor:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 2000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

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

.toast.success {
    border-color: var(--accent-green);
}

.toast.success .toast-icon {
    color: var(--accent-green);
}

.toast.error {
    border-color: var(--accent-red);
}

.toast.error .toast-icon {
    color: var(--accent-red);
}

.toast.warning {
    border-color: var(--accent-yellow);
}

.toast.warning .toast-icon {
    color: var(--accent-yellow);
}

/* Error Message */
.error-message {
    color: var(--accent-red);
    font-size: 13px;
    margin-top: 15px;
    text-align: center;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-green);
}

.badge-danger {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-red);
}

.badge-warning {
    background: rgba(210, 153, 34, 0.15);
    color: var(--accent-yellow);
}

/* Input Small */
.input-sm {
    width: 80px;
    padding: 5px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

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

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }
}
