/* Custom Silk Theme Definition for DaisyUI */
[data-theme="silk"] {
    color-scheme: light;
    --p: 340 40% 90%; /* Primary: Soft blush pink */
    --s: 36 30% 85%;  /* Secondary: Warm beige */
    --a: 200 30% 85%; /* Accent: Soft powder blue */
    --n: 20 10% 30%;  /* Neutral: Soft charcoal */
    --b1: 40 20% 98%; /* Base 100: Silky off-white */
    --b2: 40 20% 94%; /* Base 200: Slightly darker silk */
    --b3: 40 20% 88%; /* Base 300: Shadow silk */
    --bc: 20 10% 30%; /* Base content: Dark gray/charcoal */
    --pc: 20 10% 30%;
    --sc: 20 10% 30%;
    --ac: 20 10% 30%;
    --nc: 40 20% 98%;
}

/* Custom Styles & Utilities */
body {
    touch-action: pan-x pan-y;
    -webkit-tap-highlight-color: transparent;
}

/* --- Stamp Viewfinder Guides --- */
.camera-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 75vw;
    max-width: 320px;
    aspect-ratio: 4 / 5;
    z-index: 9;
    pointer-events: none;
    box-shadow: 0 0 0 9999px hsl(40, 20%, 94%);
    transition: all 0.3s ease;
}

.stamp-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 75vw;
    max-width: 320px;
    aspect-ratio: 4 / 5;
    z-index: 10;
    pointer-events: none;
    transition: all 0.3s ease;

    border: 20px solid transparent;
    border-image: url("data:image/svg+xml,%3Csvg width='120' height='120' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cmask id='m'%3E%3Crect width='120' height='120' fill='white'/%3E%3Crect x='20' y='20' width='80' height='80' fill='black'/%3E%3Ccircle cx='0' cy='0' r='8' fill='black'/%3E%3Ccircle cx='40' cy='0' r='8' fill='black'/%3E%3Ccircle cx='80' cy='0' r='8' fill='black'/%3E%3Ccircle cx='120' cy='0' r='8' fill='black'/%3E%3Ccircle cx='0' cy='40' r='8' fill='black'/%3E%3Ccircle cx='120' cy='40' r='8' fill='black'/%3E%3Ccircle cx='0' cy='80' r='8' fill='black'/%3E%3Ccircle cx='120' cy='80' r='8' fill='black'/%3E%3Ccircle cx='0' cy='120' r='8' fill='black'/%3E%3Ccircle cx='40' cy='120' r='8' fill='black'/%3E%3Ccircle cx='80' cy='120' r='8' fill='black'/%3E%3Ccircle cx='120' cy='120' r='8' fill='black'/%3E%3C/mask%3E%3C/defs%3E%3Crect width='120' height='120' fill='white' mask='url(%23m)'/%3E%3C/svg%3E") 30 round;
}

/* Override Cropper.js UI */
.cropper-view-box {
    outline: none !important;
    border: 20px solid transparent;
    border-image: url("data:image/svg+xml,%3Csvg width='120' height='120' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cmask id='m'%3E%3Crect width='120' height='120' fill='white'/%3E%3Crect x='20' y='20' width='80' height='80' fill='black'/%3E%3Ccircle cx='0' cy='0' r='8' fill='black'/%3E%3Ccircle cx='40' cy='0' r='8' fill='black'/%3E%3Ccircle cx='80' cy='0' r='8' fill='black'/%3E%3Ccircle cx='120' cy='0' r='8' fill='black'/%3E%3Ccircle cx='0' cy='40' r='8' fill='black'/%3E%3Ccircle cx='120' cy='40' r='8' fill='black'/%3E%3Ccircle cx='0' cy='80' r='8' fill='black'/%3E%3Ccircle cx='120' cy='80' r='8' fill='black'/%3E%3Ccircle cx='0' cy='120' r='8' fill='black'/%3E%3Ccircle cx='40' cy='120' r='8' fill='black'/%3E%3Ccircle cx='80' cy='120' r='8' fill='black'/%3E%3Ccircle cx='120' cy='120' r='8' fill='black'/%3E%3C/mask%3E%3C/defs%3E%3Crect width='120' height='120' fill='white' mask='url(%23m)'/%3E%3C/svg%3E") 30 round !important;
}
.cropper-dashed, .cropper-line { display: none !important; }
.cropper-modal { background-color: hsl(40, 20%, 94%) !important; }

/* --- Borderless Mode Overrides --- */
body.is-borderless .stamp-guide {
    border: 2px dashed rgba(255, 255, 255, 0.5) !important;
    border-image: none !important;
}

body.is-borderless .cropper-view-box {
    border: 2px dashed rgba(255, 255, 255, 0.5) !important;
    border-image: none !important;
    outline: none !important;
}

/* Lighter Envelope Background for Result View over base theme */
.envelope-bg {
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
}

/* Generated Stamp Shadow */
.result-shadow {
    filter: drop-shadow(0px 8px 12px rgba(0, 0, 0, 0.15)) drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.1));
    max-width: 85%;
    max-height: 50vh;
    border-radius: 4px;
}

.hide { display: none !important; }

/* --- Mobile Responsiveness --- */
@media (max-height: 700px) {
    .result-shadow {
        max-height: 32vh;
    }
}

@media (max-width: 400px) {
    .stamp-compact-card {
        padding: 12px !important;
        gap: 10px !important;
    }
    .stamp-compact-grid {
        gap: 8px !important;
    }
    .stamp-compact-canvas {
        margin-bottom: 16px !important;
        margin-top: 4px !important;
    }
    .stamp-compact-actions {
        gap: 8px !important;
    }
    .stamp-compact-actions .btn {
        min-width: 72px !important;
        font-size: 13px !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
}

@media (max-height: 600px) {
    .result-shadow {
        max-height: 28vh;
    }
    .stamp-compact-card {
        padding: 10px !important;
    }
    .stamp-compact-canvas {
        margin-bottom: 10px !important;
    }
}
