@import url('https://fonts.cdnfonts.com/css/uk-number-plate');

/* ===== FONT DEFINITIONS ===== */
@font-face {
    font-family: 'UKNumberPlate';
    src: local('FE Engschrift'), local('UKNumberPlate'), local('CarPlate');
    unicode-range: U+0041-005A, U+0061-007A, U+0030-0039;
    font-display: swap;
}

/* ===== CSS VARIABLES ===== */
:root {
    /* Colors */
    --color-primary: #007bff;
    --color-border-light: #dbdbdb;
    --color-rear-plate: #ffd700;
    --color-text-dark: #000;
    --color-text-light: #666;
    --color-badge-border: #ddd;
    
    /* Spacing */
    --spacing-xs: 2px;
    --spacing-sm: 4px;
    --spacing-md: 8px;
    --spacing-lg: 10px;
    --spacing-xl: 12px;
    
    /* Typography */
    --font-family-plate: "UKNumberPlate", "FE Engschrift", "CarPlate", "Arial Narrow", Arial, sans-serif;
    --font-size-sm: 12px;
    --font-size-base: 13px;
    --font-size-lg: 14px;
    --font-size-xl: 44px;
    --font-size-plate: 125px;
    
    /* Shadows */
    --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-btn-hover: 0 4px 8px rgba(0, 0, 0, 0.1);
    
    /* Borders */
    --border-radius-sm: 3px;
    --border-radius-md: 4px;
    --border-radius-lg: 5px;
}

/* ===== BASE STYLES ===== */
* {
    box-sizing: border-box;
}

body {
    font-feature-settings: "kern" 1, "liga" 1;
    margin: 0;
    padding: 0;
}

/* ===== TYPOGRAPHY ===== */
.text-style-plate-text {
    font-size: var(--font-size-xl);
    font-weight: normal;
    margin-bottom: 0;
    margin-top: 54px;
    letter-spacing: 5px;
    color: var(--color-text-dark);
    text-align: center;
    flex-grow: 1;
    font-family: var(--font-family-plate);
    text-transform: uppercase;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#text_style_rear_text {
    padding-top: var(--spacing-md);
}

.plate-text {
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-plate);
    font-weight: normal;
    letter-spacing: 5px;
    color: var(--color-text-dark);
    text-align: center;
    flex-grow: 1;
    font-family: var(--font-family-plate);
    text-transform: uppercase;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    padding: 0;
}

.ImgText.plate-text {
    font-size: 0;
    padding: 33.5px;
}

/* ===== BACKGROUNDS ===== */
#text_style_backfround {
    background-image: url('https://platestyler.co.uk/frontend/plates/default.png');
    width: 100%;
    height: 257px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

/* ===== PLATE CONTAINERS ===== */
#front_plate,
#rear_plate {
    width: 100% !important;
    height: 195px !important;
}

.plate {
    position: relative;
    display: inline-block;
    margin: 0 auto;
    background: #fff;
    border: var(--spacing-md) solid var(--color-border-light);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    font-family: var(--font-family-plate);
    box-shadow: var(--shadow-card);
    max-width: 100%;
}

.plate.rear-plate {
    background: var(--color-rear-plate);
}

.plate-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    position: relative;
    padding: 0 var(--spacing-lg);
}

/* ===== PLATE ELEMENTS ===== */
.badge-area {
    position: absolute;
    left: var(--spacing-lg);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.badge-dot {
    width: var(--spacing-md);
    height: var(--spacing-md);
    border-radius: 50%;
    display: block;
}

.badge-dot.small {
    width: 6px;
    height: 6px;
}

.sign {
    position: absolute;
    bottom: 11px;
    right: 94px;
    border: 1px solid #4e4e4e;
    font-size: var(--font-size-sm);
    font-weight: 700;
    padding: 0 var(--spacing-sm);
}

.sign-la {
    position: absolute;
    bottom: var(--spacing-xl);
    font-size: var(--font-size-base);
    font-weight: 700;
    right: 20px;
}

.watermark {
    position: absolute;
    bottom: var(--spacing-xl);
    font-size: var(--font-size-base);
    font-weight: 700;
}

.plate-label {
    font-size: var(--font-size-lg);
    color: var(--color-text-light);
    font-weight: 500;
}

/* ===== CUSTOM IMAGES ===== */
.minicustomImg {
    margin-top: 49px;
    margin-left: 43px;
}

.customImg img {
    height: 95px;
    max-width: 100%;
    object-fit: contain;
}

/* ===== TEXT EFFECTS ===== */
/* Regular Style */
.text-style-plate-text.regular,
.plate-text.regular {
    font-weight: normal !important;
    text-shadow: none !important;
}

/* 30 Gel Style */
.text-style-plate-text.gel-30,
.gel-30 {
    font-weight: normal !important;
    text-shadow: 0 8px 1px rgba(5, 5, 5, 0.15), 
                 0 3px 2px rgba(0, 0, 0, 0), 
                 0 4px 3px rgba(6, 6, 6, 0.44) !important;
}

/* 40 3mm Style */
.text-style-plate-text.gel-50,
.gel-50 {
    font-weight: bold !important;
    text-shadow: 0 5px 0 #6c6969, 
                 0 9px 0 #393838, 
                 0 6px 0 #070707, 
                 0 18px 5px rgba(0, 0, 0, 1), 
                 0 0 6px rgba(2, 1, 0, 0.1), 
                 0 19px 18px rgba(0, 0, 0, 0.15) !important;
}

.dx4-double-acrylic-gel {
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 
                 0 2px 0 rgba(255, 255, 255, 0.2), 
                 0 3px 2px rgba(0, 0, 0, 0.2), 
                 0 4px 3px rgba(0, 0, 0, 0.15), 
                 0 5px 4px rgba(0, 0, 0, 0.1) !important;
}

.d4-matte {
    color: #111;
    font-weight: 700;
    /*letter-spacing: 1px;*/
    text-shadow: 1px 1px 0 #2a2a2a,
                 2px 2px 0 #3a3a3a,
                 3px 3px 0 #4a4a4a,
                 4px 4px 0 #5a5a5a,
                 5px 5px 8px rgba(0, 0, 0, 0.4);
}

.d4-mm3 {
    text-shadow: 1px 1px 0 #111,
                 2px 2px 0 #111,
                 3px 3px 0 #111,
                 4px 4px 3px rgba(0, 0, 0, 0.4);
}

/* 50 5mm Style */
.text-style-plate-text.gel-40,
.gel-40 {
    font-weight: bold !important;
    text-shadow: 0 1px 0 #ddd,
                 0 2px 0 #ccc,
                 0 3px 0 #bbb,
                 0 4px 0 #aaa,
                 0 5px 1px rgba(0, 0, 0, 0.2),
                 0 6px 2px rgba(0, 0, 0, 0.15),
                 0 7px 3px rgba(0, 0, 0, 0.1) !important;
}

/* 4DX Double Acrylic + Gel */
.text-style-plate-text.dx4-double-acrylic-gel,
.dx4-double-acrylic-gel {
    font-weight: bold !important;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 
                 0 2px 0 rgba(255, 255, 255, 0.2), 
                 0 3px 2px rgba(0, 0, 0, 0.2), 
                 0 4px 3px rgba(0, 0, 0, 0.15), 
                 0 5px 4px rgba(0, 0, 0, 0.1) !important;
    background: linear-gradient(to bottom, #fff 0%, #f0f0f0 50%, #000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 4D Matte */
.text-style-plate-text.d4-matte,
.d4-matte {
    font-weight: bold !important;
    text-shadow: 0 1px 0 #666,
                 0 2px 1px rgba(0, 0, 0, 0.3),
                 0 3px 2px rgba(0, 0, 0, 0.2) !important;
    filter: saturate(0.8) !important;
}

/* 4D 3mm */
.text-style-plate-text.d4-mm3,
.d4-mm3 {
    font-weight: bold !important;
    text-shadow: 0 1px 0 #999,
                 0 2px 0 #888,
                 0 3px 0 #777,
                 0 4px 1px rgba(0, 0, 0, 0.25),
                 0 5px 2px rgba(0, 0, 0, 0.2),
                 0 6px 3px rgba(0, 0, 0, 0.15) !important;
}

.text-style-plate-text.d3-gel,
.d3-gel {
    font-weight: bold !important;
    background: linear-gradient(to bottom, #555 0%, #222 40%, #000 60%, #333 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 0 #000,
                 0 4px 4px rgba(0, 0, 0, 0.6),
                 0 8px 10px rgba(0, 0, 0, 0.4);
}

/* Floating Plate */
.text-style-plate-text.floating-plate,
.floating-plate {
    font-weight: bold !important;
    text-shadow: 0 1px 0 #fff,
                 0 2px 0 #fff,
                 0 3px 0 #ff0000,
                 0 4px 2px rgba(0, 0, 0, 0.2),
                 0 8px 10px rgba(0, 0, 0, 0.15),
                 0 15px 20px rgba(0, 0, 0, 0.1) !important;
    font-style: italic;
}

/* Retro */
.text-style-plate-text.retro,
.retro {
    font-family: "UKNumberPlate", "CarPlate", sans-serif !important;
    font-weight: normal !important;
    letter-spacing: 4px !important;
    text-shadow: 0 1px 0 #ccc,
                 0 2px 1px rgba(255, 0, 0, 0.2),
                 0 3px 2px rgba(0, 0, 255, 0.2) !important;
    font-style: italic !important;
}

/* Carbon Gel */
.text-style-plate-text.carbon-gel,
.carbon-gel {
    font-weight: bold !important;
    text-shadow: 0 1px 0 #333,
                 0 2px 1px rgba(0, 0, 0, 0.4),
                 0 3px 2px rgba(0, 0, 0, 0.3) !important;
    background: linear-gradient(45deg, transparent 48%, #222 50%, transparent 52%),
                linear-gradient(-45deg, transparent 48%, #222 50%, transparent 52%),
                #000;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 6px 6px;
}

/* Ghost Letters */
.text-style-plate-text.ghost-letters,
.ghost-letters {
    font-weight: normal !important;
    color: rgba(0, 0, 0, 0.3) !important;
    background: linear-gradient(180deg, #e2d2d2 0%, #222 40%, #807575 60%, #444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 0 #000,
                 0 4px 3px rgba(0, 0, 0, 0.5),
                 0 8px 10px rgba(0, 0, 0, 0.4),
                 inset 0 2px 2px rgba(255, 255, 255, 0.3);
    -webkit-text-stroke: 3px #111;
}

/* ===== BORDER STYLES ===== */
.border-black { border-color: #000 !important; }
.border-red { border-color: #f00 !important; }
.border-lightblue { border-color: #add8e6 !important; }
.border-darkblue { border-color: #00008b !important; }
.border-midblue { border-color: #0000cd !important; }
.border-lightgreen { border-color: #90ee90 !important; }
.border-darkgreen { border-color: #006400 !important; }
.border-midgreen { border-color: #228b22 !important; }
.border-purple { border-color: #800080 !important; }
.border-yellow { border-color: #ffd700 !important; }
.border-pink { border-color: #ffc0cb !important; }
.border-burgundy { border-color: #800020 !important; }

/* ===== BUTTON STYLES ===== */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.btn-group .btn {
    flex: 1 1 auto;
    min-width: 120px;
    padding: 8px 12px;
    margin: var(--spacing-sm);
    border: 1px solid transparent;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-group .btn.active {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.btn-outline-secondary {
    border: 2px solid #b78900;
    background: #ffd950;
    border-radius: var(--border-radius-lg) !important;
}

.btn-outline-secondary:hover {
    background-color: #f8f9fa;
    color: var(--color-text-dark);
}

.btn-group.flex-wrap {
    flex-wrap: wrap;
}

/* ===== COLOR BUTTONS ===== */
.color-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.color-btn {
    width: 35px;
    height: 35px;
    border: 2px solid #dee2e6;
    border-radius: var(--border-radius-md);
    padding: 0;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    background-color: transparent;
}

.color-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-btn-hover);
}

.color-btn.active {
    border: 3px solid var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.color-btn.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    font-size: var(--font-size-lg);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Color backgrounds */
.color-btn[data-color=""] { background-color: #f8f9fa; }
.color-btn[data-color="black"] { background-color: #000; }
.color-btn[data-color="red"] { background-color: #f00; }
.color-btn[data-color="lightblue"] { background-color: #add8e6; }
.color-btn[data-color="darkblue"] { background-color: #00008b; }
.color-btn[data-color="midblue"] { background-color: #0000cd; }
.color-btn[data-color="lightgreen"] { background-color: #90ee90; }
.color-btn[data-color="darkgreen"] { background-color: #006400; }
.color-btn[data-color="midgreen"] { background-color: #228b22; }
.color-btn[data-color="purple"] { background-color: #800080; }
.color-btn[data-color="yellow"] { background-color: #ffd700; }
.color-btn[data-color="pink"] { background-color: #ffc0cb; }
.color-btn[data-color="burgundy"] { background-color: #800020; }

/* Checkmark colors */
.color-btn[data-color="black"].active::after,
.color-btn[data-color="darkblue"].active::after,
.color-btn[data-color="darkgreen"].active::after,
.color-btn[data-color="purple"].active::after,
.color-btn[data-color="burgundy"].active::after {
    color: white;
}

.color-btn[data-color="lightblue"].active::after,
.color-btn[data-color="lightgreen"].active::after,
.color-btn[data-color="yellow"].active::after,
.color-btn[data-color="pink"].active::after,
.color-btn[data-color="midblue"].active::after,
.color-btn[data-color="midgreen"].active::after,
.color-btn[data-color="red"].active::after {
    color: #000;
}

/* ===== COLOR DISPLAY ===== */
.selected-color,
.selected-border {
    font-weight: bold;
    color: var(--color-primary);
    margin-left: var(--spacing-md);
    font-size: var(--font-size-lg);
    background: #f8f9fa;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--border-radius-md);
    border: 1px solid #dee2e6;
}

/* ===== RESPONSIVE BREAKPOINTS ===== */
/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .plate {
        max-width: 680px;
    }
}

/* Large devices (desktops, 992px to 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .plate {
        max-width: 480px;
    }
    
    .plate-text {
        font-size: 85px;
        letter-spacing: 4px !important;
    }
}

/* Medium devices (tablets, 768px to 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    :root {
        --font-size-xl: 40px;
    }
    
    .plate-text {
        font-size: 70px;
        letter-spacing: 4px !important;
    }
    
    .plate {
        max-width: 440px;
        border-width: 6px;
    }
    
    .btn-group .btn {
        min-width: 100px;
        font-size: var(--font-size-sm);
        padding: 6px 10px;
    }
}

/* Small devices (landscape phones, 576px to 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    :root {
        --font-size-xl: 35px;
        --font-size-plate: 60px;
    }
    
    .plate-text {
        font-size: 60px;
        letter-spacing: 3px !important;
        border-width: 2px;
    }
    
    .text-style-plate-text {
        font-size: 35px;
        letter-spacing: 3px !important;
    }
    
    .plate {
        transform: scale(0.9);
        max-width: 400px;
        border-width: 5px;
    }
    
    #front_plate,
    #rear_plate {
        height: 175px !important;
    }
    
    .badge-area {
        left: var(--spacing-md);
    }
    
    .btn-group .btn {
        min-width: 90px;
        font-size: 11px;
        padding: 5px 8px;
    }
    
    .color-btn {
        width: 32px;
        height: 32px;
    }
    
    .sign {
        right: 70px;
        bottom: 8px;
    }
    
    .sign-la {
        right: 15px;
        bottom: 8px;
        font-size: 11px;
    }
    
    .watermark {
        bottom: 8px;
        font-size: 11px;
    }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
    :root {
        --font-size-xl: 28px;
        --font-size-plate: 45px;
        --spacing-md: 6px;
    }
    
    .plate-text {
        font-size: 62px ;
        letter-spacing: 2px !important;
        border-width: 2px;
    }
    
    .text-style-plate-text {
        font-size: 63px !important;
        letter-spacing: 2px !important;
        margin-top: 41px;
    }
    
    .plate {
        transform: scale(0.85);
        max-width: 340px;
        border-width: 4px;
    }
    
    #front_plate,
    #rear_plate {
        height: 150px !important;
    }
    
    .badge-area {
        left: 5px;
        gap: 1px;
    }
    
    .badge-dot {
        width: 6px;
        height: 6px;
    }
    
    .badge-dot.small {
        width: 4px;
        height: 4px;
    }
    
    .btn-group .btn {
        min-width: 70px;
        font-size: 10px;
        padding: 4px 6px;
        margin: 3px;
    }
    
    .color-btn {
        width: 28px;
        height: 28px;
    }
    
    .color-btn.active::after {
        font-size: 12px;
    }
    
    .selected-color,
    .selected-border {
        font-size: 12px;
        margin-left: 5px;
        padding: 2px 5px;
    }
    
    .sign {
        right: 50px;
        bottom: 6px;
        font-size: 8px;
        padding: 1px 3px;
    }
    
    .sign-la {
        right: 12px;
        bottom: 6px;
        font-size: 9px;
    }
    
    .watermark {
        bottom: 6px;
        font-size: 9px;
    }
    
    .minicustomImg {
        margin-top: 25px;
        margin-left: 20px;
    }
    
    .customImg img {
        height: 80px !important;
    }
    
    .ImgText.plate-text {
        padding: 20px;
    }
}

/* Very small devices (less than 400px) */
@media (max-width: 399.98px) {
    :root {
        --font-size-plate: 38px;
    }
    
    .plate-text {
        font-size: 38px;
    }
    
    .plate {
        transform: scale(0.75);
        max-width: 300px;
    }
    
    #front_plate,
    #rear_plate {
        height: 130px !important;
    }
    
    .btn-group .btn {
        min-width: 60px;
        font-size: 9px;
    }
    
    .sign {
        right: 35px;
    }
}

/* Print styles */
@media print {
    .plate {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .btn-group,
    .color-btn-group {
        display: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .plate {
        border: 3px solid #000;
    }
    
    .plate-text {
        color: #000;
        text-shadow: none !important;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .color-btn,
    .btn {
        transition: none;
    }
    
    .color-btn:hover {
        transform: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .plate {
        box-shadow: 0 2px 10px rgba(255, 255, 255, 0.1);
    }
}

/* Font feature support */
@supports (font-variation-settings: normal) {
    .plate-text,
    .text-style-plate-text {
        font-variation-settings: "wdth" 100, "wght" 400;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .color-btn:hover {
        transform: none;
    }
    
    .btn:hover {
        background-color: inherit;
    }
}