:root {
    --primary-color: #2196F3;
    --secondary-color: #607D8B;
    --error-color: #f44336;
    --success-color: #4CAF50;
    --background-color: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --sidebar-bg: #f5f5f5;
    --card-bg: #ffffff;
    --hover-color: #e3f2fd;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-menu li {
    margin: 5px 0;
}

.nav-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.3s;
}

.nav-menu a:hover {
    background-color: var(--hover-color);
}

.nav-menu .active a {
    background-color: var(--primary-color);
    color: white;
}

.nav-menu .icon {
    margin-right: 10px;
    font-size: 1.2rem;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 20px;
}

.content-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.content-header h2 {
    margin: 0;
    color: var(--primary-color);
}

/* Card Styles */
.card {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
    border: 1.5px solid var(--border-color, #b0b0b0);
}

.firewall-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
    border: 1.5px solid #bbb;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.firewall-card:hover {
    border-color: #aaa;
    box-shadow: 0 2px 8px rgba(33,150,243,0.08);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
    gap: 28px 24px;
    margin-top: 18px;
    align-items: stretch;
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 12px;
    padding-right: 12px;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    background-color: var(--card-bg);
    color: var(--text-color);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

/* Button Styles */
.button,
.button.secondary,
.button.danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    max-width: 120px;
    width: 110px;
    height: 38px;
    padding: 0 10px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    text-align: center;
    box-sizing: border-box;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    text-decoration: none;
}

.button {
    background-color: var(--primary-color);
    color: white;
}

.button.secondary {
    background-color: var(--secondary-color);
    color: white;
}

.button.danger {
    background-color: #dc3545;
    color: white;
}

/* Status Messages */
.error {
    background-color: #ffebee;
    color: var(--error-color);
    padding: 15px;
    border-radius: 4px;
    margin: 10px 0;
    border: 1px solid var(--error-color);
}

.success {
    background-color: #e8f5e9;
    color: var(--success-color);
    padding: 15px;
    border-radius: 4px;
    margin: 10px 0;
    border: 1px solid var(--success-color);
}

/* Dark Mode Styles */
body.dark-mode {
    --background-color: #1a1a1a;
    --text-color: #ffffff;
    --border-color: #404040;
    --sidebar-bg: #2d2d2d;
    --card-bg: #2d2d2d;
    --hover-color: #3d3d3d;
}

body.dark-mode .form-group input {
    background-color: #3d3d3d;
    color: #ffffff;
    border-color: #404040;
}

body.dark-mode .error {
    background-color: #3d1a1a;
    border-color: #ff5252;
}

body.dark-mode .success {
    background-color: #1a3d1a;
    border-color: #4caf50;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        margin-left: 0;
    }

    .nav-menu {
        display: flex;
        flex-wrap: wrap;
    }

    .nav-menu li {
        flex: 1;
        min-width: 120px;
    }
}

/* Settings Page Styles */
.settings-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.settings-section h3 {
    margin: 0 0 1rem 0;
    color: var(--text-color);
    font-size: 1.2rem;
}

.settings-form {
    max-width: 500px;
}

.info-group {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--bg-color);
    border-radius: 4px;
}

.info-group label {
    font-weight: bold;
    margin-right: 1rem;
    min-width: 120px;
}

.info-group span {
    color: var(--text-color);
}

/* Dark mode adjustments for settings */
body.dark-mode .settings-section {
    background: var(--card-bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.dark-mode .info-group {
    background: var(--bg-color);
}

/* Checkbox Styles */
.form-group.checkbox {
    display: flex;
    align-items: center;
    margin: 1rem 0;
}

.form-group.checkbox label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.form-group.checkbox input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

/* Form Actions with Remember Me */
.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}

.remember-me {
    display: flex;
    align-items: center;
}

.remember-me label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    margin: 0;
}

.remember-me input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

/* Login page specific styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--background-color);
}

.login-container .card {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    box-shadow: 0 4px 24px rgba(33, 150, 243, 0.08), 0 1.5px 4px rgba(0,0,0,0.04);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    padding: 2.5rem 2rem 2rem 2rem;
}

.login-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: 700;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    margin: 0 auto;
}

.login-form label {
    font-weight: 500;
    color: var(--text-color);
}

.login-form input[type="email"],
.login-form input[type="password"] {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
    border-color: var(--primary-color);
    outline: none;
}

.login-form .form-actions {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-top: 1rem;
}

.login-form .remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.98rem;
}

.login-form .remember-me label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
}

.login-form .remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.login-form button {
    width: 100%;
    max-width: none;
    padding: 0.85rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    transition: background-color 0.2s;
    box-shadow: 0 2px 8px rgba(33,150,243,0.08);
}

.login-form button:hover {
    background-color: #1976D2;
}

/* Dark mode adjustments for login page */
body.dark-mode .login-container .card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-mode .login-form input[type="email"],
body.dark-mode .login-form input[type="password"] {
    background-color: var(--sidebar-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

.firewall-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.firewall-header {
    margin-bottom: 0.5em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.firewall-header span,
.firewall-header a.host {
    margin-bottom: 0 !important;
    white-space: nowrap;
    flex-shrink: 0;
}

.firewall-stats {
    margin-bottom: 0.5em;
}

.load-bar-segments, .ram-bar {
    height: 10px;
    border-radius: 5px;
    background: #eee;
    display: flex;
    overflow: hidden;
    position: relative;
}

.load-bar-segments {
    width: 90px;
}

.ram-bar {
    width: 120px;
}

.stat {
    margin-top: 0.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.theme-label {
    color: var(--text-color);
    user-select: none;
    transition: color 0.3s;
}

body.dark-mode .theme-label {
    color: #fff;
}

/* Toggle Switch Styles */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #eee;
  transition: .3s;
  border-radius: 24px;
  border: 1px solid #ccc;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 2.5px;
  background-color: #03a9f4;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(33,150,243,0.10);
}
.switch input:checked + .slider {
  background-color: #e3f2fd;
  border-color: #2196F3;
}
.switch input:checked + .slider:before {
  transform: translateX(18px);
  background-color: #03a9f4;
}
/* Focus style */
.switch input:focus + .slider {
  box-shadow: 0 0 1px #2196F3;
}

@media (max-width: 600px) {
    .firewall-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    .firewall-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

.action-btn {
    min-width: 100px;
    max-width: 120px;
    width: 110px;
    height: 38px;
    padding: 0 10px;
    font-size: 15px;
    text-align: center;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fw-title {
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 0;
    padding-bottom: 0;
    line-height: 1.1;
    width: 100%;
    display: block;
}

.fw-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 2px;
    gap: 10px;
}

.fw-update-status {
    white-space: nowrap;
    margin-left: 12px;
}

.action-btn.wide {
    min-width: 130px;
    width: 140px;
}

.button.secondary,
.button.danger,
.action-btn {
    text-decoration: none;
}

.button.secondary:hover,
.button.danger:hover,
.button:hover,
.action-btn:hover {
    text-decoration: none;
}