/* Controls */
.rsc-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.rsc-unit-toggle {
  display: inline-flex;
  padding: 4px;
  background: #f3f4f6;
	border-radius: 5px;
  border: 1px solid #e5e7eb;
}

.rsc-unit-btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s;
}

.rsc-unit-btn.active {
  background: #1d4ed8;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.rsc-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
}

.rsc-reset-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* Form Sections */
.rsc-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.rsc-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.5rem;
}

.rsc-label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 1rem;
}

.rsc-required {
  color: #dc2626;
  font-weight: 700;
}

/* Roof Types */
.rsc-roof-types {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .rsc-roof-types {
    grid-template-columns: repeat(4, 1fr);
  }
}

.rsc-roof-type {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.rsc-roof-type input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rsc-roof-type:hover {
  border-color: #93c5fd;
}

.rsc-roof-type.active {
  border-color: #1d4ed8;
  background: #eff6ff;
}

.rsc-roof-icon {
  width: 64px;
  height: 48px;
  margin-bottom: 0.5rem;
  color: #6b7280;
  transition: color 0.2s;
}

.rsc-roof-type.active .rsc-roof-icon {
  color: #1d4ed8;
}

.rsc-roof-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: #374151;
}

.rsc-roof-type.active .rsc-roof-name {
  color: #1d4ed8;
}

.rsc-roof-desc {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 2px;
}

.rsc-roof-type.active::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: #1d4ed8;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dimensions */
.rsc-dimensions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .rsc-dimensions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .rsc-dimensions-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.rsc-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rsc-field-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.rsc-field-label svg {
  flex-shrink: 0;
}

.rsc-field input,
.rsc-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  background: #fff;
  color: #111827;
  transition: all 0.2s;
}

.rsc-field input:focus,
.rsc-input:focus,
.rsc-select:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.rsc-hint {
  font-size: 0.8125rem;
  color: #9ca3af;
  margin: 0.5rem 0 0;
}

/* Pitch */
.rsc-pitch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.rsc-pitch-angle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.rsc-pitch-angle strong {
  font-size: 1.25rem;
  font-family: 'SF Mono', 'Menlo', monospace;
  color: #1d4ed8;
}

.rsc-pitch-row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-end;
}

.rsc-pitch-visual {
  position: relative;
  width: 96px;
  height: 96px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  flex-shrink: 0;
  overflow: hidden;
}

.rsc-pitch-visual svg {
  width: 100%;
  height: 100%;
}

.rsc-pitch-label {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: #1d4ed8;
}

.rsc-pitch-select-wrap {
  flex: 1;
}

.rsc-select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  background: #fff;
  color: #111827;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* Material */
.rsc-material-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.rsc-material {
  position: relative;
  padding: 1rem;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.rsc-material input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rsc-material:hover {
  border-color: #93c5fd;
}

.rsc-material.active {
  border-color: #1d4ed8;
  background: #eff6ff;
}

.rsc-material-name {
  display: block;
  font-weight: 600;
  color: #111827;
}

.rsc-material-desc {
  display: block;
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 2px;
}

.rsc-material-tag {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #059669;
}

.rsc-material.active::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: #1d4ed8;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Thickness */
.rsc-thickness-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .rsc-thickness-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.rsc-thickness {
  position: relative;
  padding: 0.75rem;
  text-align: center;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
}

.rsc-thickness input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rsc-thickness:hover {
  border-color: #93c5fd;
}

.rsc-thickness.active {
  border-color: #1d4ed8;
  background: #eff6ff;
}

.rsc-thickness-in {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: #374151;
}

.rsc-thickness.active .rsc-thickness-in {
  color: #1d4ed8;
}

.rsc-thickness-mm {
  display: block;
  font-size: 0.75rem;
  color: #9ca3af;
}

/* Sheet Info */
.rsc-sheet-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  font-size: 0.875rem;
  color: #6b7280;
}

.rsc-sheet-info strong {
  color: #111827;
}

/* Waste Factor */
.rsc-waste-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.rsc-waste-header strong {
  font-size: 1.25rem;
  font-family: 'SF Mono', 'Menlo', monospace;
  color: #1d4ed8;
}

.rsc-tooltip {
  display: inline-flex;
  align-items: center;
  color: #9ca3af;
  cursor: help;
  margin-left: 4px;
}

.rsc-waste-presets {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.rsc-waste-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.625rem 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 5px;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
}

.rsc-waste-btn small {
  font-size: 0.6875rem;
  font-weight: 400;
  color: #9ca3af;
}

.rsc-waste-btn:hover {
  border-color: #93c5fd;
}

.rsc-waste-btn.active {
  border-color: #1d4ed8;
  background: #eff6ff;
  color: #1d4ed8;
}

.rsc-slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: #e5e7eb;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.rsc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #1d4ed8;
  border-radius: 20%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.rsc-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #1d4ed8;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.rsc-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}

/* Results */
.rsc-results {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 2rem;
}

.rsc-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.rsc-results-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.rsc-print-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.3);
}

.rsc-print-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.4);
}

.rsc-main-result {
  text-align: center;
  padding: 2rem;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 2px solid #93c5fd;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.rsc-main-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1d4ed8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.rsc-main-value {
  display: block;
  font-size: 3rem;
  font-weight: 700;
  font-family: 'SF Mono', 'Menlo', monospace;
  color: #1d4ed8;
  line-height: 1;
}

.rsc-main-desc {
  display: block;
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.5rem;
}

.rsc-results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .rsc-results-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.rsc-result-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
}

.rsc-result-icon {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.rsc-result-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
}

.rsc-result-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'SF Mono', 'Menlo', monospace;
  color: #111827;
  margin: 0.25rem 0;
}

.rsc-result-unit {
  display: block;
  font-size: 0.75rem;
  color: #9ca3af;
}

.rsc-cost-card {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.rsc-cost-card .rsc-result-icon {
  color: #059669;
}

.rsc-cost-card .rsc-result-value {
  color: #059669;
}

/* Summary */
.rsc-summary {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.25rem;
}

.rsc-summary h4 {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 1rem;
}

.rsc-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  border-bottom: 1px solid #e5e7eb;
}

.rsc-summary-row:last-child {
  border-bottom: none;
}

.rsc-summary-row span {
  color: #6b7280;
}

.rsc-summary-row strong {
  color: #111827;
}

.rsc-summary-total strong {
  color: #1d4ed8;
  font-size: 1rem;
}

/* Comparison Table */
.rsc-comparison {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 2rem;
}

.rsc-comparison h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 0.25rem;
}

.rsc-comparison-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0 0 1rem;
}

.rsc-table-wrap {
  overflow-x: auto;
}

.rsc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.rsc-table th,
.rsc-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.rsc-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #111827;
}

.rsc-table td {
  color: #6b7280;
}

.rsc-table td:first-child {
  font-weight: 500;
  color: #374151;
}

.rsc-table tr:nth-child(even) {
  background: #fafafa;
}

.rsc-winner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #d1fae5;
  color: #059669;
  font-size: 10px;
  font-weight: 700;
  border-radius: 20%;
  margin-right: 6px;
}

.rsc-recommendation {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  background: #f9fafb;
  border-radius: 5px;
  font-size: 0.8125rem;
  color: #6b7280;
}

/* How To */
.rsc-howto {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 2rem;
}

.rsc-howto h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 1.5rem;
}

.rsc-howto-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .rsc-howto-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.rsc-howto-item h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 0.5rem;
}

.rsc-howto-item p {
  font-size: 0.8125rem;
  color: #6b7280;
  margin: 0;
}

.rsc-howto-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 5px;
  margin-bottom: 0.75rem;
}

/* Formula */
.rsc-formula {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 2rem;
}

.rsc-formula h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 1rem;
}

.rsc-formula-box {
  background: #f9fafb;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-family: 'SF Mono', 'Menlo', Consolas, monospace;
  font-size: 0.875rem;
  color: #374151;
}

.rsc-formula-box p {
  margin: 0.5rem 0;
}

.rsc-formula-note {
  font-size: 0.8125rem;
  color: #6b7280;
  margin: 1rem 0 0;
}

/* Print Styles */
@media print {
  .rsc-controls,
  .rsc-print-btn,
  .rsc-reset-btn {
    display: none !important;
  }
  
  .rsc-calculator {
    max-width: 100%;
  }
  
  .rsc-section,
  .rsc-results,
  .rsc-comparison,
  .rsc-howto,
  .rsc-formula {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #e5e7eb;
  }
}