/* Container & Layout */
.container,
.page-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 16px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title,
h1 {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 16px 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Card Container */
.card,
.form-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

.form-card {
    max-width: 640px;
}

/* Buttons */
.btn,
button:not(.nav-icon):not(.close) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    padding: 10px 22px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.btn:active,
button:not(.nav-icon):not(.close):active {
    transform: translateY(1px);
}

.btn:focus-visible,
button:not(.nav-icon):not(.close):focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.btn-primary,
button:not(.btn-secondary):not(.btn-danger):not(.btn-link):not(.nav-icon):not(.close) {
    background-color: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.btn-primary:hover,
button:not(.btn-secondary):not(.btn-danger):not(.btn-link):not(.nav-icon):not(.close):hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
    color: #111827;
}

.btn-danger {
    background-color: #dc2626 !important;
    color: #ffffff !important;
    border-color: #dc2626 !important;
}

.btn-danger:hover {
    background-color: #b91c1c !important;
    border-color: #b91c1c !important;
    color: #ffffff !important;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 16px;
    border-radius: 10px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 6px;
}

/* Form Controls & Inputs */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
textarea,
select,
.form-control {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    color: #1f2937;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus,
.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

textarea,
textarea.form-control {
    min-height: 110px;
    resize: vertical;
    line-height: 1.5;
}

/* Form Groups & Labels */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label,
label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"],
input[type="checkbox"].form-check-input {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #2563eb;
}

.form-check-label,
.form-check label {
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    user-select: none;
}

/* Fieldset / Form Sections */
.form-section,
fieldset {
    border: 1px solid #e5e7eb;
    background-color: #f9fafb;
    border-radius: 8px;
    padding: 18px 20px 10px 20px;
    margin: 24px 0;
}

.form-section-title,
legend {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    padding: 0 8px;
}

/* Help text and Errors */
.form-help,
.form-text,
small {
    display: block;
    font-size: 13px;
    color: #6b7280;
    margin-top: 6px;
    line-height: 1.4;
}

.form-errors,
.form-group ul {
    color: #dc2626;
    font-size: 13px;
    margin-top: 6px;
    margin-bottom: 0;
    padding-left: 18px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.4;
}

.alert-danger,
.alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

/* Action Bars */
.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.inline-form {
    display: inline-block;
    margin: 0;
}

/* CRUD layout */
.crud-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.crud-main {
    flex: 1;
    min-width: 320px;
}

.crud-sidebar {
    width: 360px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .crud-sidebar {
        width: 100%;
    }
}

/* Tables in CRUD */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

.table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

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

.table.details-table th {
    width: 180px;
    background-color: #f9fafb;
}

.domain-link {
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
}

.domain-link:hover {
    text-decoration: underline;
}
