/* Parchment Theme - Ornate Borders with Greek Key Pattern */

/* ===== GREEK KEY PATTERN DEFINITIONS ===== */
/* Horizontal Greek Key Pattern (for top/bottom borders) */
@supports (background-image: repeating-linear-gradient(90deg, #d4c5b9, #d4c5b9)) {
    :root {
        --greek-key-horizontal: repeating-linear-gradient(
            90deg,
            var(--color-accent, #c4b5a9) 0px,
            var(--color-accent, #c4b5a9) 8px,
            transparent 8px,
            transparent 16px,
            var(--color-accent, #c4b5a9) 16px,
            var(--color-accent, #c4b5a9) 20px,
            transparent 20px,
            transparent 24px
        );
    }
}

/* ===== MAJOR ORNATE BORDER STYLES ===== */

/* Main container with full ornate borders */
.border-major-ornate {
    position: relative;
    border: 8px solid var(--color-accent, #c4b5a9);
    border-image: linear-gradient(135deg, var(--color-button-bg, #d4af37), var(--color-accent, #c4b5a9), var(--color-button-bg, #d4af37)) 1;
    box-shadow: 
        inset 0 0 0 1px var(--color-button-bg, #d4af37),
        0 0 0 1px var(--color-accent, #c4b5a9),
        0 8px 16px rgba(0, 0, 0, 0.15);
    background: var(--color-primary, #f5f1e8);
    padding: 1rem;
}

/* Ornate border styling using pseudo-elements for corners */
.border-major-ornate::before,
.border-major-ornate::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--color-button-bg, #d4af37);
    box-shadow: inset -2px -2px 4px rgba(0, 0, 0, 0.2), inset 2px 2px 4px rgba(255, 255, 255, 0.3);
}

.border-major-ornate::before {
    top: -4px;
    left: -4px;
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
}

.border-major-ornate::after {
    top: -4px;
    right: -4px;
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
}

/* Bottom corners using additional pseudo-elements */
.border-major-ornate > *:first-child::before,
.border-major-ornate > *:last-child::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--color-button-bg, #d4af37);
    box-shadow: inset -2px -2px 4px rgba(0, 0, 0, 0.2), inset 2px 2px 4px rgba(255, 255, 255, 0.3);
}

.border-major-ornate > *:first-child::before {
    bottom: -20px;
    left: -4px;
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
}

.border-major-ornate > *:last-child::before {
    bottom: -20px;
    right: -4px;
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
}

/* Alternative simpler corner implementation */
.parchment-theme .border-major-ornate::before,
.parchment-theme .border-major-ornate::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    background: 
        linear-gradient(135deg, transparent 0%, transparent 40%, var(--color-button-bg, #d4af37) 40%, var(--color-button-bg, #d4af37) 60%, transparent 60%, transparent 100%);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

.parchment-theme .border-major-ornate::before {
    top: -12px;
    left: -12px;
}

.parchment-theme .border-major-ornate::after {
    top: -12px;
    right: -12px;
}

/* ===== SUB-AREA BORDERS (THIN SANDSTONE LINES) ===== */

/* Thin sandstone border for sub-sections */
.border-sub {
    border: 1px solid var(--color-accent, #c4b5a9);
    border-radius: 4px;
    padding: 0.75rem;
}

/* Form section borders */
.parchment-theme fieldset,
.parchment-theme .form-section {
    border: 1px solid var(--color-accent, #c4b5a9);
    border-radius: 4px;
    padding: 1rem;
    margin: 1rem 0;
    background: var(--color-primary, #f5f1e8);
}

.parchment-theme fieldset legend {
    background: var(--color-primary, #f5f1e8);
    padding: 0 0.5rem;
    color: #4a3c32;
    font-weight: bold;
}

/* ===== TABLE ORNATE BORDERS ===== */

/* Table with ornate frame */
.table-ornate {
    border-collapse: collapse;
    border: 4px double var(--color-accent, #c4b5a9);
    background: var(--color-primary, #f5f1e8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Auto-apply ornate styling to tables in parchment theme */
.parchment-theme table {
    border-collapse: collapse;
    border: 3px double var(--color-accent, #c4b5a9);
    background: var(--color-primary, #f5f1e8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin: 1rem 0;
    width: 100%;
}

.parchment-theme table thead {
    background: linear-gradient(to right, 
        var(--color-accent, #c4b5a9) 0%,
        var(--color-button-bg, #d4af37) 50%,
        var(--color-accent, #c4b5a9) 100%
    );
    color: #4a3c32;
    font-weight: bold;
}

.parchment-theme table thead th {
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-button-bg, #d4af37);
    text-align: left;
    font-size: 0.95em;
}

.parchment-theme table tbody tr {
    border-bottom: 1px solid var(--color-accent, #c4b5a9);
}

.parchment-theme table tbody tr:hover {
    background: rgba(212, 175, 55, 0.05);
}

.parchment-theme table td {
    padding: 0.65rem;
    border-right: 1px solid rgba(196, 181, 169, 0.3);
}

.parchment-theme table td:last-child {
    border-right: none;
}

.table-ornate {
    border-collapse: collapse;
    border: 4px double var(--color-accent, #c4b5a9);
    background: var(--color-primary, #f5f1e8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ===== PARCHMENT BACKGROUND UTILITIES ===== */

/* Parchment background with subtle texture */
.parchment-bg {
    background: 
        linear-gradient(135deg, rgba(212, 175, 55, 0.02) 0%, transparent 50%, rgba(196, 181, 169, 0.02) 100%),
        #f5f1e8;
    position: relative;
}

/* Light parchment for cards/panels */
.parchment-card {
    background: 
        linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, transparent 50%, rgba(212, 175, 55, 0.03) 100%),
        linear-gradient(to bottom, #f5f1e8, #ebe5d9);
    border: 1px solid rgba(196, 181, 169, 0.4);
    border-radius: 4px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Ornate card with border */
.parchment-card.ornate {
    border: 3px solid var(--color-accent, #c4b5a9);
    border-image: linear-gradient(135deg, var(--color-button-bg, #d4af37), var(--color-accent, #c4b5a9), var(--color-button-bg, #d4af37)) 1;
    box-shadow: 
        inset 0 0 0 1px var(--color-button-bg, #d4af37),
        0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ===== TEXT COLOR FOR PARCHMENT THEME ===== */

.parchment-theme {
    color: #4a3c32;
}

.parchment-theme h1,
.parchment-theme h2,
.parchment-theme h3,
.parchment-theme h4,
.parchment-theme h5,
.parchment-theme h6 {
    color: #4a3c32;
}

.parchment-theme a {
    color: var(--color-link, #8b7355);
}

.parchment-theme a:hover {
    color: var(--color-button-bg, #d4af37);
}

/* ===== INPUT & FORM STYLING FOR PARCHMENT ===== */

.parchment-theme input[type="text"],
.parchment-theme input[type="password"],
.parchment-theme input[type="email"],
.parchment-theme input[type="number"],
.parchment-theme input[type="date"],
.parchment-theme input[type="time"],
.parchment-theme textarea,
.parchment-theme select {
    background: var(--color-primary, #f5f1e8);
    color: #4a3c32;
    border: 1px solid var(--color-accent, #c4b5a9);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 1em;
    font-family: inherit;
    transition: all 0.3s ease;
}

.parchment-theme input:focus,
.parchment-theme textarea:focus,
.parchment-theme select:focus {
    outline: none;
    border-color: var(--color-button-bg, #d4af37);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3), inset 0 0 3px rgba(212, 175, 55, 0.1);
    background: var(--color-primary, #f5f1e8);
}

.parchment-theme input:disabled,
.parchment-theme textarea:disabled,
.parchment-theme select:disabled {
    background: #e8e0d5;
    color: #999;
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== BUTTON STYLING FOR PARCHMENT ===== */

.parchment-theme button,
.parchment-theme input[type="submit"],
.parchment-theme input[type="button"],
.parchment-theme .btn-parchment {
    background: var(--color-button-bg, #d4af37);
    color: var(--color-button-text, #4a3c32);
    border: 2px solid var(--color-accent, #c4b5a9);
    border-radius: 4px;
    padding: 0.75rem 1.5rem;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.3);
}

.parchment-theme button:hover,
.parchment-theme input[type="submit"]:hover,
.parchment-theme input[type="button"]:hover,
.parchment-theme .btn-parchment:hover {
    background: #e6c200;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.5);
    transform: translateY(-2px);
}

.parchment-theme button:active,
.parchment-theme input[type="submit"]:active,
.parchment-theme input[type="button"]:active,
.parchment-theme .btn-parchment:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(212, 175, 55, 0.3);
}

/* ===== DECORATIVE ACCENT LINES ===== */

/* Horizontal divider with gold accents */
.parchment-divider {
    border: none;
    height: 2px;
    background: linear-gradient(to right, 
        var(--color-accent, #c4b5a9) 0%,
        var(--color-button-bg, #d4af37) 50%,
        var(--color-accent, #c4b5a9) 100%
    );
    margin: 2rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Vertical accent line */
.parchment-vline {
    border-left: 3px solid var(--color-button-bg, #d4af37);
    padding-left: 1rem;
    margin: 1rem 0;
}

/* ===== MEDIA QUERIES FOR RESPONSIVE BORDERS ===== */

@media (max-width: 768px) {
    .border-major-ornate {
        border-width: 6px;
        padding: 0.75rem;
    }
    
    .border-major-ornate::before,
    .border-major-ornate::after {
        width: 12px;
        height: 12px;
    }
    
    .table-ornate th,
    .table-ornate td {
        padding: 0.5rem;
        font-size: 0.9em;
    }
    
    .parchment-card {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .border-major-ornate {
        border-width: 4px;
        padding: 0.5rem;
        margin: 0.5rem;
    }
    
    .border-major-ornate::before,
    .border-major-ornate::after {
        width: 10px;
        height: 10px;
    }
    
    .table-ornate {
        font-size: 0.85em;
    }
    
    .table-ornate th,
    .table-ornate td {
        padding: 0.4rem;
    }
    
    .parchment-theme button,
    .parchment-theme input[type="submit"] {
        padding: 0.6rem 1rem;
        font-size: 0.95em;
    }
}

/* ===== PRINT FRIENDLY STYLES ===== */

@media print {
    .border-major-ornate,
    .border-sub,
    .parchment-card {
        border: 1px solid #999 !important;
        box-shadow: none !important;
    }
    
    .border-major-ornate::before,
    .border-major-ornate::after {
        display: none;
    }
    
    .parchment-bg {
        background: white !important;
    }
}
