/* Custom Styles for Network Tools Suite */

:root {
  --primary-color: #0d6efd;
  --secondary-color: #6c757d;
  --success-color: #198754;
  --info-color: #0dcaf0;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --light-color: #f8f9fa;
  --dark-color: #212529;

  /* Light mode colors */
  --bg-body: #f8f9fa;
  --bg-gradient-start: #f5f7fa;
  --bg-gradient-end: #c3cfe2;
  --bg-card: #ffffff;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --border-color: #dee2e6;
  --shadow-color: rgba(0, 0, 0, 0.1);
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  min-height: 100vh;
  color: var(--text-primary);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

/* Main content area should grow to fill space */
.container.py-4 {
  flex: 1;
}

/* Disabled button styles */
.btn-group .btn-check:disabled + .btn,
.btn-group .btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Custom validation styles */
.form-control.is-warning {
  border-color: #ffc107;
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23ffc107'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='M5.8 4.6L6.2 7.4'/%3e%3cpath d='M6 8.2h.01'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.warning-feedback {
  width: 100%;
  margin-top: 0.25rem;
  font-size: 0.875em;
  color: #664d03;
}

/* Footer styles */
.footer-fixed {
  background-color: #212529 !important;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
  border-top: 1px solid #495057 !important;
}

.footer-fixed .text-white {
  color: #ffffff !important;
}

.footer-fixed .text-light {
  color: #f8f9fa !important;
}

.footer-fixed .btn-outline-light {
  border-color: #f8f9fa;
  color: #f8f9fa;
}

.footer-fixed .btn-outline-light:hover {
  background-color: #f8f9fa;
  border-color: #f8f9fa;
  color: #212529;
}

.footer-fixed .border-light {
  border-color: #495057 !important;
}

.navbar-brand {
  font-size: 1.5rem;
  letter-spacing: -0.5px;
}

.nav-link {
  font-weight: 500;
  transition: all 0.3s ease;
  border-radius: 0.375rem;
  margin: 0 0.25rem;
}

.nav-link:hover:not(.disabled) {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.nav-link.active {
  background-color: rgba(255, 255, 255, 0.2);
  font-weight: 600;
}

.card {
  border-radius: 1rem;
  overflow: hidden;
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.card-header {
  border: none;
  padding: 1.5rem;
}

.card-body {
  padding: 2rem;
}

.form-control {
  border-radius: 0.5rem;
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
  transform: translateY(-1px);
}

.form-control-lg {
  padding: 0.75rem 1rem;
  font-size: 1.1rem;
}

.btn {
  border-radius: 0.5rem;
  font-weight: 500;
  transition: all 0.3s ease;
  padding: 0.75rem 1.5rem;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

.table {
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.table thead th {
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 0.875rem;
  border: none;
  padding: 1rem;
}

.table tbody td {
  padding: 1rem;
  border-color: #f8f9fa;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
}

.table-hover tbody tr:hover {
  background-color: rgba(13, 110, 253, 0.05);
  transform: scale(1.005);
  transition: all 0.2s ease;
}

.alert {
  border-radius: 0.75rem;
  border: none;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.alert-success {
  background: linear-gradient(135deg, #d1e7dd 0%, #a3d9a4 100%);
  color: #0f5132;
}

.alert-danger {
  background: linear-gradient(135deg, #f8d7da 0%, #f1aeb5 100%);
  color: #842029;
}

.alert-info {
  background: linear-gradient(135deg, #d1ecf1 0%, #abd6e6 100%);
  color: #055160;
}

.badge {
  font-size: 0.7rem;
  padding: 0.35em 0.65em;
  border-radius: 0.375rem;
}

.form-text {
  font-size: 0.875rem;
  color: #6c757d;
  margin-top: 0.5rem;
}

.fade-in {
  animation: fadeIn 0.5s ease-in;
}

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

.result-item {
  background: white;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 0.5rem;
  border-left: 4px solid var(--primary-color);
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.ip-result-success {
  border-left-color: var(--success-color);
  background: linear-gradient(135deg, #f8fff9 0%, #e8f1f5 100%);
}

.ip-result-error {
  border-left-color: var(--danger-color);
  background: linear-gradient(135deg, #fff8f8 0%, #f5e8e8 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
  .card-body {
    padding: 1.5rem;
  }

  .btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }

  .table-responsive {
    font-size: 0.8rem;
  }

  .navbar-brand {
    font-size: 1.25rem;
  }
}

/* Loading Animation */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Number Converter Specific Styles */
#number-converter-tool .result-item input[readonly] {
  background-color: var(--bg-card);
  border: 2px solid #e9ecef;
  font-family: "Courier New", monospace;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

#number-converter-tool .result-item input[readonly]:focus {
  border-color: var(--info-color);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

#number-converter-tool .example-btn {
  transition: all 0.3s ease;
}

#number-converter-tool .example-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Input validation styling */
#input-number.is-invalid {
  border-color: var(--danger-color);
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 0.4 6'/%3e%3cpath d='M6 8.2h.01'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

#input-number.is-valid {
  border-color: var(--success-color);
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='m2.3 6.73 0.13-.02 1.92-2.23c.78-.9 1.47-1.73 1.47-1.73l.75-.71v1.79l-2.99 3.24c-.13.15-.06.13-.16.15-.1.02-.07-.01-.17-.16L.95 4.81V2.26l.73.65c.02.01.1.04.19.08l1.35 1.75c.02.02.05.06.08.09l.02.01z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.ip-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid #000000;
  border-radius: 0.25rem;
  overflow: hidden;
  font-size: 20px;
}
.ip-grid-col {
  display: flex;
  flex-direction: column;
  border-right: 1px solid #dee2e6;
}
.ip-grid-col:last-child {
  border-right: none;
}
.ip-grid-header,
.ip-grid-cell {
  padding: 0.5rem;
  text-align: center;
}
.ip-grid-header {
  background-color: #f8f9fa;
  font-weight: bold;
  border-bottom: 1px solid #dee2e6;
}
.ip-grid-cell {
  border-bottom: 1px solid #dee2e6;
  font-size: 0.9em;
}
.ip-grid-col .ip-grid-cell:last-child {
  border-bottom: none;
}

/* Prefix-length grid */
.prefix-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border: 1px solid #000000;
  border-radius: 0.25rem;
  overflow: hidden;
  margin-bottom: 1rem;
  font-size: 20px;
}
.prefix-grid-header,
.prefix-grid-cell {
  padding: 0.5rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #dee2e6;
  border-bottom: 1px solid #dee2e6;
}
.prefix-grid-header {
  background-color: #f8f9fa;
  font-weight: bold;
}
.prefix-grid-header:last-child,
.prefix-grid-cell:last-child {
  border-right: none;
}
.prefix-grid-cell {
  font-size: 0.9em;
}
