* {
    box-sizing: border-box;
}

body {
    font-family: 'Times New Roman', Times, serif;
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
    padding: 20px;
    background-color: #ffffff;
    color: #000000;
}

.back-link {
    color: #000000;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: none;
}

main {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
}

header h1 {
    font-size: 24px;
    font-weight: normal;
    margin: 0 0 8px 0;
}

.thick-rule {
    border: none;
    border-top: 3px solid #000000;
    margin: 15px 0;
}

/* Sections */
#sections-container {
    margin: 20px 0;
}

.section {
    margin: 20px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.section-title {
    flex: 1;
}

.section-title .name {
    font-size: 16px;
}

.section-title .type {
    color: #666;
    font-style: italic;
    margin-left: 8px;
    font-size: 15px;
}

.section-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.order-controls {
    display: flex;
    flex-direction: column;
    gap: 0;
    line-height: 0.8;
}

.order-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #000000;
    font-size: 10px;
    line-height: 1;
}

.order-btn:hover {
    color: #999;
}

.order-btn:disabled {
    color: #ccc;
    cursor: default;
}

.section-actions button:not(.order-btn) {
    background: none;
    border: none;
    color: #000000;
    cursor: pointer;
    font-family: 'Times New Roman', Times, serif;
    font-size: 15px;
    padding: 0;
    text-decoration: underline;
}

.section-actions button:not(.order-btn):hover {
    color: #666;
}

/* Section content preview */
.section-content {
    margin: 10px 0 15px 0;
    color: #000;
}

.section-content p {
    margin: 8px 0;
}

.section-content .preview-title {
    font-weight: bold;
    margin-bottom: 5px;
}

/* Section Edit Form */
.section-edit {
    margin: 15px 0;
}

.form-row {
    margin: 12px 0;
    display: flex;
    align-items: baseline;
}

.form-row label {
    min-width: 120px;
    margin-right: 10px;
    font-size: 15px;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="url"],
.form-row input[type="number"],
.form-row input[type="date"],
.form-row select,
.form-row textarea {
    flex: 1;
    font-family: 'Times New Roman', Times, serif;
    font-size: 15px;
    border: none;
    border-bottom: 1px solid #000000;
    padding: 2px 0;
    background: transparent;
}

.form-row textarea {
    border: 1px solid #000000;
    padding: 8px;
    min-height: 100px;
    resize: vertical;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none;
    border-bottom-color: #666;
}

.form-row textarea:focus {
    border-color: #666;
}

.form-row select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: transparent;
    border: 1px solid #000000;
    padding: 4px 28px 4px 8px;
    cursor: pointer;
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="black" d="M6 9L1 4h10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.form-row input[type="range"] {
    flex: 1;
}

.form-row .range-value {
    min-width: 30px;
    text-align: right;
    margin-left: 10px;
}

/* Checkbox row */
.form-row.checkbox-row {
    align-items: center;
}

.form-row.checkbox-row input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

/* Days selector */
.days-selector {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.day-toggle {
    cursor: pointer;
}

.day-toggle input {
    display: none;
}

.day-toggle span {
    display: block;
    padding: 4px 8px;
    border: 1px solid #000;
    font-size: 12px;
    min-width: 36px;
    text-align: center;
}

.day-toggle input:checked + span {
    background: #000;
    color: #fff;
}

/* List items (for countdown, todos) */
.list-items {
    margin: 10px 0;
}

.list-item {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 8px 0;
    padding: 8px;
    border: 1px solid #ddd;
    flex-wrap: wrap;
}

.list-item input[type="text"],
.list-item input[type="date"] {
    border: none;
    border-bottom: 1px solid #000;
    padding: 2px 0;
    font-family: 'Times New Roman', Times, serif;
    font-size: 15px;
    background: transparent;
}

.list-item input[type="text"] {
    flex: 1;
    min-width: 120px;
}

.list-item input[type="date"] {
    width: auto;
}

.list-item .remove-item {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #999;
    padding: 0 4px;
}

.list-item .remove-item:hover {
    color: #000;
}

.add-item-btn {
    background: none;
    border: none;
    color: #000;
    cursor: pointer;
    font-family: 'Times New Roman', Times, serif;
    font-size: 14px;
    padding: 4px 0;
    text-decoration: underline;
}

.add-item-btn:hover {
    color: #666;
}

/* Edit form buttons */
.edit-buttons {
    margin: 15px 0 15px 120px;
    display: flex;
    gap: 15px;
}

.edit-buttons button {
    background: none;
    border: none;
    color: #000000;
    cursor: pointer;
    font-family: 'Times New Roman', Times, serif;
    font-size: 15px;
    padding: 0;
    text-decoration: underline;
}

.edit-buttons button:hover {
    color: #666;
}

/* Buttons */
.text-button {
    background: none;
    border: none;
    color: #000000;
    cursor: pointer;
    font-family: 'Times New Roman', Times, serif;
    font-size: 15px;
    padding: 0;
    text-decoration: none;
    display: inline-block;
    margin: 10px 0;
}

.text-button:hover {
    text-decoration: underline;
}

.text-button:disabled {
    color: #999;
    cursor: default;
}

.text-button:disabled:hover {
    text-decoration: none;
}

#add-section-btn {
    display: block;
    margin: 20px 0;
}

.primary-button {
    font-family: 'Times New Roman', Times, serif;
    font-size: 18px;
    padding: 8px 24px;
    background: #ffffff;
    border: 2px solid #000000;
    cursor: pointer;
}

.primary-button:hover {
    background: #f5f5f5;
}

.primary-button:disabled {
    border-color: #999;
    color: #999;
    cursor: default;
}

.button-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
}

/* Schedule form */
.schedule-form {
    margin: 25px 0;
}

.schedule-form .form-row {
    margin: 15px 0;
}

/* Messages */
.message {
    margin: 15px 0;
    padding: 12px;
    display: none;
    font-size: 14px;
}

.message.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.message.error {
    background: #ffebee;
    color: #c62828;
}

.message.visible {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    main {
        padding: 10px;
    }

    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-row label {
        margin-bottom: 5px;
    }

    .form-row input,
    .form-row select,
    .form-row textarea {
        width: 100%;
    }

    .edit-buttons {
        margin-left: 0;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-actions {
        margin-top: 8px;
    }

    .button-row {
        flex-direction: column;
        gap: 10px;
    }

    .list-item {
        flex-direction: column;
        align-items: stretch;
    }

    .list-item .days-selector {
        margin-top: 8px;
    }
}
