/* Core layout and form styles separated from templates to comply with CSP */
p {
    margin-top: 7px;
    margin-bottom: 7px;
}

.hidden {
    display: none !important;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.header p {
    font-size: 16px;
    opacity: 0.95;
}

.warning {
    background: #fff4e6;
    border-left: 4px solid #f39c12;
    padding: 15px 20px;
    margin: 20px 30px;
    border-radius: 5px;
}

.warning strong {
    color: #e74c3c;
}

.warning p {
    color: #7f8c8d;
    font-size: 14px;
    line-height: 1.5;
}

.form-container {
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
}

label .required {
    color: #e74c3c;
}

input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ecf0f1;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

select {
    width: 100%;
    padding: 12px 40px 12px 12px;
    border: 2px solid #ecf0f1;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: white;
    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='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

/* Custom dropdown styling */
.custom-dropdown {
    position: relative;
    display: block;
    width: 100%;
}

.dropdown-toggle {
    width: 100%;
    padding: 12px 40px 12px 12px;
    border: 2px solid #ecf0f1;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    background-color: white;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.dropdown-toggle:hover {
    border-color: #3498db;
}

.dropdown-toggle:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.dropdown-arrow {
    position: absolute;
    right: 12px;
    display: inline-block;
    width: 12px;
    height: 12px;
    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='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.dropdown-toggle.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #ecf0f1;
    border-top: none;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    padding: 14px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

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

.dropdown-item:hover {
    background-color: #f8fbff;
}

.dropdown-item.selected {
    background-color: #e8f4f8;
}

.item-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #2c3e50;
}

.item-description {
    font-size: 12px;
    color: #7f8c8d;
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3498db;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.help-text {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 5px;
}

button[type="submit"] {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 15px 40px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

button[type="submit"]:active {
    transform: translateY(0);
}

.honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.conditional-field {
    display: none;
}

.conditional-field.active {
    display: block;
}

/* Organization identifier field with type dropdown and value input */
#orgIdField select {
    margin-bottom: 10px;
}

.input-with-prefix {
    display: flex;
    align-items: stretch;
}

.input-prefix {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #e9ecef;
    border: 1px solid #ccc;
    border-right: none;
    border-radius: 5px 0 0 5px;
    font-family: monospace;
    font-size: 14px;
    color: #495057;
    white-space: nowrap;
}

/* When there is no visible prefix (e.g., OIN), hide the element and allow
   the input to show full rounded corners */
.input-prefix.no-prefix {
    display: none;
}
.input-prefix.no-prefix + input {
    border-radius: 5px;
}

.input-with-prefix input {
    flex: 1;
    border-radius: 0 5px 5px 0;
    margin: 0;
}

.client-error {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
}

.embed-mode {
    background: transparent;
    padding: 0;
}

.embed-mode .container {
    box-shadow: none;
    border-radius: 0;
}

.flash-messages {
    margin: 20px 30px;
}

.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.alert-success {
    background: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.footer {
    background: #ecf0f1;
    padding: 20px 30px;
    text-align: center;
    font-size: 13px;
    color: #7f8c8d;
    border-top: 1px solid #ddd;
}

.footer p {
    margin: 5px 0;
}

.footer strong {
    color: #2c3e50;
}

.client-error {
    color: #c0392b;
    margin-top: 6px;
    font-size: 0.95rem;
}

/* Demo page styling */
body.demo {
    font-family: Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #f5f5f5;
}

.demo h1 {
    color: #2c3e50;
}

.demo .demo-section {
    background: white;
    padding: 30px;
    margin: 20px 0;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.demo .code-block {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 20px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 15px 0;
}

.demo .code-block code {
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.demo .note {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
    padding: 15px;
    margin: 15px 0;
    border-radius: 5px;
}
