@import url('https://fonts.googleapis.com/css2?family=Aref+Ruqaa+Ink:wght@400;700&family=Baloo+Bhaijaan+2:wght@400;600;800&display=swap');

@font-face {
    font-family: "myFont";
    src: url("../Font/myFont.otf");
}

/* Base styling & Variables */
:root {
    --primary-color: #4facfe;
    --primary-dark: #00f2fe;
    --secondary-color: #ff0844;
    --secondary-dark: #ffb199;
    --success-color: #43e97b;
    --warning-color: #f6d365;
    --text-main: #333;
    --bg-light: #fdfbfb;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --border-radius: 20px;
    --font-ui: 'Baloo Bhaijaan 2', cursive, sans-serif;
    --font-heading: 'Aref Ruqaa Ink', serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-ui);
    color: var(--text-main);
    background: url("../pictures/backgroundimage.jpg") center/cover no-repeat fixed;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    direction: rtl;
    overflow-x: hidden;
}

/* We want an overlay so text is readable over the bg image */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(161, 196, 253, 0.75);
    /* Slight blue tint overlay */
    z-index: -1;
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 900px;
    min-height: 85vh;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

/* Header */
.app-header {
    background: linear-gradient(to right, var(--primary-color), var(--primary-dark));
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.app-header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Content Area */
.app-content {
    flex: 1;
    padding: 2rem;
    position: relative;
    overflow-y: auto;
}

.page {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typography */
h2 {
    color: var(--primary-color);
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    font-family: var(--font-heading);
}

/* Welcome Box */
.welcome-box {
    text-align: center;
    padding: 3rem 1rem;
}

.welcome-box p {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: #555;
    font-weight: 600;
}

/* Buttons */
.btn {
    font-family: var(--font-ui);
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(to right, var(--secondary-color), var(--secondary-dark));
    color: white;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-success {
    background: linear-gradient(to right, #11998e, #38ef7d);
    color: white;
}

.btn-warning {
    background: linear-gradient(to right, #f6d365, #fda085);
    color: white;
    color: #333;
}

.btn-large {
    font-size: 1.5rem;
    padding: 1rem 3rem;
}

.btn-icon {
    padding: 0.5rem 1rem;
    font-size: 1.5rem;
    border-radius: 12px;
}

.mt-3 {
    margin-top: 1.5rem;
}

/* Cards Layout */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: white;
    border-radius: var(--border-radius);
    padding: 2.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.05);
}

.card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(79, 172, 254, 0.2);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-family: var(--font-heading);
    color: var(--secondary-color);
}

.card h3 {
    font-size: 1.8rem;
    color: #444;
}

/* Items Grid (Stars/Letters/Numbers) */
.items-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    padding: 1rem 0;
}

.grid-item {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    border-radius: 25px;
    /* Squircle look */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    user-select: none;
    font-family: var(--font-heading);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.grid-item:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.grid-item:active {
    transform: scale(0.95);
}

/* Variety of colors for items */
.grid-item:nth-child(5n+1) {
    background: linear-gradient(135deg, #ff0844, #ffb199);
}

.grid-item:nth-child(5n+2) {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}

.grid-item:nth-child(5n+3) {
    background: linear-gradient(135deg, #43e97b, #38ef7d);
}

.grid-item:nth-child(5n+4) {
    background: linear-gradient(135deg, #fa709a, #fee140);
}

.grid-item:nth-child(5n+5) {
    background: linear-gradient(135deg, #a18cd1, #fbc2eb);
}


.bottom-actions {
    margin-top: 3rem;
    text-align: center;
}

/* Workspace Layout */
.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: white;
    padding: 1rem 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.workspace-header h2 {
    margin-bottom: 0;
}

.workspace-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: stretch;
}

@media(max-width: 768px) {
    .workspace-layout {
        grid-template-columns: 1fr;
    }
}

.reference-pane {
    text-align: center;
    background: white;
    padding: 3rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.reference-pane p {
    font-size: 1.5rem;
    color: #666;
    margin-bottom: 1rem;
}

.reference-character {
    font-size: 10rem;
    font-family: "myFont", var(--font-heading);
    color: var(--primary-color);
    line-height: 1;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.1);
}

.canvas-pane {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.canvas-container {
    background: white;
    padding: 15px;
    border-radius: 20px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05), 0 8px 15px rgba(0, 0, 0, 0.05);
    width: 100%;
    display: flex;
    justify-content: center;
}

canvas {
    border: 3px dashed #bbdefb;
    border-radius: 15px;
    background-color: #fff;
    cursor: crosshair;
    touch-action: none;
    max-width: 100%;
}

.canvas-tools {
    display: flex;
    gap: 1rem;
    width: 100%;
    justify-content: center;
}

.prediction-result {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.5rem;
    font-weight: bold;
    animation: fadeIn 0.3s;
    width: 100%;
    max-width: 400px;
}

.prediction-result.success {
    background-color: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.prediction-result.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

.prediction-result img {
    width: 40px;
    height: 40px;
}

.hidden {
    display: none !important;
}

/* Footer */
.app-footer {
    background: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 1.5rem;
    font-size: 1.1rem;
    color: #555;
    font-weight: 600;
}