@charset "utf-8";

/* Modern CSS Variables for theming */
:root {
  --primary-color: #4a69bd;
  --primary-light: #6c7fd8;
  --primary-dark: #3c5aa6;
  --secondary-color: #f8f9fa;
  --accent-color: #5f27cd;
  --text-primary: #2c3e50;
  --text-secondary: #7f8c8d;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --border-color: #dee2e6;
  --border-radius: 8px;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  margin: 0;
  padding: 0;
}

/* Header Styles */
#header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 2rem 0;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

#header h1 {
  font-size: 2rem;
  font-weight: 600;
  margin: 0;
  text-align: center;
  letter-spacing: -0.5px;
}

/* Section Styles */
.section {
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  margin: 1.5rem;
  padding: 2rem;
  transition: var(--transition);
}

.section:hover {
  box-shadow: var(--shadow-md);
}

.section h2 {
  color: var(--primary-color);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--bg-tertiary);
}

/* Form Styles */
#queryform {
  margin: 0;
}

#prefixestext {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-secondary);
  font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
  font-size: 0.875rem;
  height: 4rem;
  overflow-y: auto;
  padding: 0.75rem;
  margin-bottom: 1rem;
  resize: vertical;
}

/* CodeMirror Container */
.CodeMirror {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
  font-size: 0.875rem;
  height: 320px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.CodeMirror-focused {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.1);
}

/* Button and Select Styles */
input[type="button"],
input[type="submit"],
button {
  background: var(--primary-color);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.625rem 1.5rem;
  transition: var(--transition);
  margin-left: 0.5rem;
}

input[type="button"]:hover,
input[type="submit"]:hover,
button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

input[type="button"]:active,
input[type="submit"]:active,
button:active {
  transform: translateY(0);
  box-shadow: none;
}

select {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.875rem;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  transition: var(--transition);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237f8c8d' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  appearance: none;
}

select:hover {
  border-color: var(--primary-color);
}

select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.1);
}

/* Query Controls */
.query-controls {
  margin-top: 1rem;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.controls-row label {
  font-weight: 500;
  color: var(--text-primary);
}

/* EasySPARQL Form */
#moreform {
  background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  margin: 1.5rem;
  padding: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

#moreform label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

#moreform input[type="text"] {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  transition: var(--transition);
  width: 10rem;
}

#moreform input[type="text"]:hover {
  border-color: var(--primary-color);
}

#moreform input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.1);
}

/* Results Section */
#ressection {
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  margin: 1.5rem;
  padding: 2rem;
  min-height: 200px;
  position: relative;
}

#result {
  color: var(--text-primary);
  font-size: 1rem;
}

#result .empty {
  color: var(--primary-color);
  font-weight: 500;
}

/* Query Results Table */
.queryresults {
  background: var(--bg-primary);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  margin-top: 1.5rem;
  overflow: hidden;
  width: 100%;
}

.queryresults th {
  background: var(--primary-color);
  color: white;
  font-weight: 600;
  padding: 1rem;
  text-align: left;
  white-space: nowrap;
}

.queryresults th:first-child {
  border-top-left-radius: var(--border-radius);
}

.queryresults th:last-child {
  border-top-right-radius: var(--border-radius);
}

.queryresults td {
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  vertical-align: top;
}

.queryresults tr:last-child td {
  border-bottom: none;
}

.queryresults tr:hover td {
  background: var(--bg-secondary);
}

/* Alternating row colors */
.queryresults .odd td {
  background: var(--bg-primary);
}

.queryresults .even td {
  background: var(--bg-secondary);
}

/* Links */
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.uri a,
a.uri,
a.qname {
  font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
  font-size: 0.875rem;
  color: var(--accent-color);
}

/* Footer */
#footer {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 2rem 0;
  padding: 1rem;
  text-align: center;
}

#footer a {
  color: var(--primary-color);
  font-weight: 500;
}

/* Loading/Busy State */
.busy {
  color: var(--text-secondary);
  position: relative;
}

.busy:after {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 0.5rem;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  #header h1 {
    font-size: 1.5rem;
  }
  
  .section,
  #ressection,
  #moreform {
    margin: 1rem;
    padding: 1.5rem;
  }
  
  .queryresults {
    font-size: 0.875rem;
    overflow-x: auto;
    display: block;
  }
  
  .queryresults th,
  .queryresults td {
    padding: 0.5rem;
  }
  
  #moreform {
    flex-direction: column;
    align-items: stretch;
  }
  
  #moreform input[type="text"] {
    width: 100%;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #5f7cdb;
    --primary-light: #7a93e6;
    --primary-dark: #4a69bd;
    --text-primary: #e9ecef;
    --text-secondary: #adb5bd;
    --bg-primary: #212529;
    --bg-secondary: #343a40;
    --bg-tertiary: #495057;
    --border-color: #495057;
  }
  
  body {
    background-color: #1a1d21;
  }
  
  .CodeMirror {
    background: var(--bg-primary);
    color: var(--text-primary);
  }
  
  .queryresults tr:hover td {
    background: var(--bg-tertiary);
  }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }